def get_selected_item_sprite(self, pos): if self.get_selected_item().is_empty_cell(): return None i, j = pos x = j * GameVars.INVENTORY_CELL_SIZE + GameVars.INVENTORY_TOP_LEFT[0] y = i * GameVars.INVENTORY_CELL_SIZE + GameVars.INVENTORY_TOP_LEFT[1] return Sprite(x, y, None)
def get_blank_required_items(self): offset_x = GameVars.REQUIRED_ITEMS_TOP_LEFT[0] y = GameVars.REQUIRED_ITEMS_TOP_LEFT[1] sprites = [] width = GameVars.REQUIRED_ITEMS_WIDTH while len(sprites) < width: x = offset_x sprite = Sprite(x, y, '-1') sprites.append(sprite) offset_x += GameVars.REQUIRED_ITEMS_CELL_SIZE return sprites
def get_sprites(self): tile_matrix = self.screen_map.get_tiles() self.sprite_list = [] for i in range(len(tile_matrix.matrix)): for j in range(len(tile_matrix.matrix[0])): tile_code = tile_matrix.matrix[i][j] x = j * GameVars.TILE_SIZE - self.camera.offset_x y = i * GameVars.TILE_SIZE - self.camera.offset_y sprite = Sprite(x, y, tile_code) self.sprite_list.append(sprite) return self.sprite_list
def get_sprites(self): matrix = self.inventory.get_matrix() sprite_list = [] for i in range(matrix.height): for j in range(matrix.width): tile_code = matrix[i, j].tile_code x = j * GameVars.INVENTORY_CELL_SIZE + GameVars.INVENTORY_TOP_LEFT[ 0] y = i * GameVars.INVENTORY_CELL_SIZE + GameVars.INVENTORY_TOP_LEFT[ 1] sprite = Sprite(x, y, tile_code) sprite_list.append(sprite) return sprite_list
def get_selected_required_items_sprites(self): crafting_item = self.crafting.get_selected() if crafting_item is None: return [] offset_x = GameVars.REQUIRED_ITEMS_TOP_LEFT[0] y = GameVars.REQUIRED_ITEMS_TOP_LEFT[1] sprites = [] for required_item in crafting_item.crafting_items_required.keys(): x = offset_x sprite = Sprite(x, y, required_item) sprites.append(sprite) offset_x += GameVars.REQUIRED_ITEMS_CELL_SIZE return sprites
def get_sprites(self): matrix = self.crafting.get_matrix() sprite_list = [] for i in range(matrix.height): for j in range(matrix.width): tile_code = matrix[(i, j)].tile_code if tile_code != '-1' and not matrix[i, j].unlocked: tile_code = '1000' x = j * GameVars.CRAFTING_CELL_SIZE + GameVars.CRAFTING_TOP_LEFT[0] y = i * GameVars.CRAFTING_CELL_SIZE + GameVars.CRAFTING_TOP_LEFT[1] sprite = Sprite(x, y, tile_code) sprite_list.append(sprite) return sprite_list
def get_crafting_button_sprite(self): x = GameVars.CRAFT_BUTTON_TOP_LEFT[0] y = GameVars.CRAFT_BUTTON_TOP_LEFT[1] return Sprite(x, y, '1')