Exemplo n.º 1
0
def main():
    running = True
    pygame.init()
    screen = pygame.display.set_mode((640, 480))
    clock = pygame.time.Clock()
    pygame.display.set_caption('Tetra Master')
    board = pygame.image.load(utils.dirlock('../data/board.bmp'))

    _selection = False
    _hand = pieces.get_hand()
    _world = worldgen.gen_world()
    turn = events.Turn()

    while running:
        # Initialization
        clock.tick(60)
        screen.blit(board,(0,0))
        trayjizzle = pygame.font.Font(utils.dirlock("../data/Trajan-Bold.ttf"), 30)
        monospizzle = pygame.font.SysFont("monospace", 15, True)
        mx, my = pygame.mouse.get_pos()
        _mouse_pos = (mx, my)
        
        # Drawing
        pygame.draw.rect(screen, (100,40,80), (150,40, 336, 408))
        utils.print_world(_world, screen)
        display_mouse_coords = monospizzle.render("(" + str(mx) + ", " + str(my) + ")", 1, (255,255,255))
        screen.blit(display_mouse_coords, (5,5))
        for monster in _hand:
            screen.blit(monster.image,(monster.xpos, monster.ypos))
            if monster.selected == True:
                current_selected = trayjizzle.render(monster.name + " is selected!", 1, (255,255,255))
                screen.blit(current_selected, (100, 100))
        for _event in pygame.event.get():
            if _event.type == QUIT:
                running = False
            elif _event.type == MOUSEBUTTONDOWN:
                if _world.currentPlayer == True:
                    _hand, _selection = turn.player(_hand,
                            _selection,
                            _mouse_pos,
                            _world)
        if _world.currentPlayer == False:
            turn.ai(_world)
        current_player_text = trayjizzle.render("Current Player: " + ("Player" if  _world.currentPlayer else "AI"), 
                1, (255,255,255))
        screen.blit(current_player_text, (50,400))

        pygame.display.update()
Exemplo n.º 2
0
 def __init__(self,blocked=False):
     self.width, self.height = (84, 102)
     self.xpos = 0
     self.ypos = 0
     self.image = None
     self.card = None
     self.blocked = blocked
     if blocked:
         self.image = pygame.image.load(utils.dirlock('../data/brick.bmp'))
Exemplo n.º 3
0
 def __init__(self, blocked=False):
     self.width, self.height = (84, 102)
     self.xpos = 0
     self.ypos = 0
     self.image = None
     self.card = None
     self.blocked = blocked
     if blocked:
         self.image = pygame.image.load(utils.dirlock('../data/brick.bmp'))
Exemplo n.º 4
0
 def __init__(self, monster):
     pygame.sprite.Sprite.__init__(self)
     self.image = pygame.image.load(utils.dirlock('../data/cards/' + monster + '.bmp'))
     self.width, self.height = (84, 102)
     self.name = monster
     self.xpos = 520
     self.ypos = 20
     self.blocked = True
     self.selected = False
     screen = pygame.display.get_surface()
Exemplo n.º 5
0
 def __init__(self, monster):
     pygame.sprite.Sprite.__init__(self)
     self.image = pygame.image.load(
         utils.dirlock('../data/cards/' + monster + '.bmp'))
     self.width, self.height = (84, 102)
     self.name = monster
     self.xpos = 520
     self.ypos = 20
     self.blocked = True
     self.selected = False
     screen = pygame.display.get_surface()
Exemplo n.º 6
0
def main():
    running = True
    pygame.init()
    screen = pygame.display.set_mode((640, 480))
    clock = pygame.time.Clock()
    pygame.display.set_caption('Tetra Master')
    board = pygame.image.load(utils.dirlock('../data/board.bmp'))
    world = worldgen.gen_world()
    cards = pieces.get_cards()
    selection = False

    while running:
        clock.tick(60)
        screen.blit(board, (0, 0))
        myfont = pygame.font.Font(utils.dirlock("../data/Trajan-Bold.ttf"), 30)
        mx, my = pygame.mouse.get_pos()
        mouse_pos = (mx, my)
        pygame.draw.rect(screen, (100, 40, 80), (150, 40, 336, 408))
        for a in world:
            for b in a:
                pygame.draw.rect(screen, (0, 0, 0), (b.xpos, b.ypos, 84, 102))
                if b.card:
                    b.draw(b.card.image)
                    screen.blit(b.image, (b.xpos, b.ypos))
        for monster in cards:
            screen.blit(monster.image, (monster.xpos, monster.ypos))
            if monster.selected == True:
                current_selected = myfont.render(
                    monster.name + " is selected!", 1, (255, 255, 255))
                screen.blit(current_selected, (100, 100))
        for event in pygame.event.get():
            if event.type == QUIT:
                running = False
            elif event.type == MOUSEBUTTONDOWN:
                cards, selection = events.watch(cards, selection, mouse_pos,
                                                world)

        pygame.display.update()
Exemplo n.º 7
0
def main():
    running = True
    pygame.init()
    screen = pygame.display.set_mode((640, 480))
    clock = pygame.time.Clock()
    pygame.display.set_caption('Tetra Master')
    board = pygame.image.load(utils.dirlock('../data/board.bmp'))
    world = worldgen.gen_world()
    cards = pieces.get_cards() 
    selection = False

    while running:
        clock.tick(60)
        screen.blit(board,(0,0))
        myfont = pygame.font.Font(utils.dirlock("../data/Trajan-Bold.ttf"), 30)
        mx,my = pygame.mouse.get_pos()
        mouse_pos = (mx, my)
        pygame.draw.rect(screen, (100,40,80), (150,40, 336, 408))
        for a in world:
            for b in a:
                pygame.draw.rect(screen, (0,0,0), (b.xpos, b.ypos, 84, 102))
                if b.card:
                    b.draw(b.card.image)
                    screen.blit(b.image, (b.xpos, b.ypos))
        for monster in cards:
            screen.blit(monster.image,(monster.xpos, monster.ypos))
            if monster.selected == True:
                current_selected = myfont.render(monster.name + " is selected!", 1, (255,255,255))
                screen.blit(current_selected, (100, 100))
        for event in pygame.event.get():
            if event.type == QUIT:
                running = False
            elif event.type == MOUSEBUTTONDOWN:
               cards, selection = events.watch(cards,selection,mouse_pos,world) 

        pygame.display.update()