def __init__(self, type): self.type = type self.cost = Settings.tower_costs[type] self.images = { f'{direction}': pygame.image.load(f'images/tower_tiles/{type}_{direction}.png') for direction in 'NESW' } self.font = pygame.font.SysFont('Arial', 24) self.cost_text_active = self.font.render(f'({self.cost})', True, pygame.Color('yellow')) self.cost_text_inactive = self.font.render(f'({self.cost})', True, pygame.Color('grey')) self.image_menu_active = pygame.image.load(f'images/tower_tiles/{type}_menu.png') self.image_menu_inactive = pygame.image.load(f'images/tower_tiles/{type}_menu_grey.png') self.image_heart = pygame.image.load(f'images/misc/heart_{type}.png') self.menu_location = utils.cell_to_isometric(Settings.menu_tower_locations[type]) + \ Vector(0, Settings.tile_height - self.image_menu_active.get_rect().height) self.cost_location = utils.cell_to_isometric( Settings.menu_tower_locations[type] + Settings.tower_cost_offset ) self.offset = Vector(0, Settings.tile_height - self.images['E'].get_rect().height)
def set_location(self): self.location = utils.cell_to_isometric( self.grid_location) + self.abstract_tile.offset
def set_location(self): offset, direction = self.offset_and_direction_on_tile() self.location = utils.cell_to_isometric(self.route[0].grid_location + offset + Vector(0.9, -2.3)) self.direction = direction
def show_level_name(self): self.canvas.blit( self.font.render(self.level_name, True, pygame.Color('white')), utils.cell_to_isometric(Settings.level_name_location).as_int_list )
def show_score(self): self.canvas.blit( self.font.render(f'{self.score}/{Settings.target_score}', True, pygame.Color('white')), utils.cell_to_isometric(Settings.score_location).as_int_list )
def show_wealth(self): self.canvas.blit( self.font.render(f'{self.wealth}', True, pygame.Color('yellow')), utils.cell_to_isometric(Settings.wealth_location).as_int_list )