diff --git a/assets/atlas.png b/assets/atlas.png index 46a2db2..f4c4682 100644 Binary files a/assets/atlas.png and b/assets/atlas.png differ diff --git a/assets/chest.png b/assets/chest.png new file mode 100644 index 0000000..563166c Binary files /dev/null and b/assets/chest.png differ diff --git a/assets/home.png b/assets/home.png new file mode 100644 index 0000000..68837dd Binary files /dev/null and b/assets/home.png differ diff --git a/survival/generators/building_generator.py b/survival/generators/building_generator.py index 79ce688..303eeac 100644 --- a/survival/generators/building_generator.py +++ b/survival/generators/building_generator.py @@ -5,14 +5,25 @@ from survival.components.sprite_component import SpriteComponent class BuildingGenerator: - def create_home(self, world, game_map): + def create_home(self, world, game_map, position = [10,10]): home = world.create_entity() - pos = PositionComponent([32, 32], [32, 32]) - world.add_component(home, pos) + home_pos = PositionComponent([position[0]*32, position[1]*32], position) + world.add_component(home, home_pos) + game_map.add_entity(home, home_pos) world.add_component(home, InventoryComponent()) - - game_map.add_entity(home, pos) - sprite = SpriteComponent('tree.png') - sprite.set_scale(2) + sprite = SpriteComponent('home.png') world.add_component(home, sprite) world.add_component(home, CollisionComponent()) + + for x_pos in [-1, 1]: + chest = world.create_entity() + chest_pos = PositionComponent( + [(position[0]+x_pos)*32, position[1]*32], + [position[0]+x_pos, position[1]] + ) + world.add_component(chest, chest_pos) + game_map.add_entity(chest, chest_pos) + world.add_component(chest, InventoryComponent()) + sprite = SpriteComponent('chest.png') + world.add_component(chest, sprite) + world.add_component(chest, CollisionComponent())