summary refs log tree commit diff stats
path: root/src/game.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'src/game.cpp')
-rw-r--r--src/game.cpp23
1 files changed, 23 insertions, 0 deletions
diff --git a/src/game.cpp b/src/game.cpp index a494c5f..e2c1b9c 100644 --- a/src/game.cpp +++ b/src/game.cpp
@@ -120,6 +120,29 @@ void Game::loadMap(const Map& map)
120 nextEntities.push_back(mapEn); 120 nextEntities.push_back(mapEn);
121 nextEntities.push_back(player); 121 nextEntities.push_back(player);
122 122
123 // this is cheating but is just for testing
124 if (&map == &m2)
125 {
126 auto saveEn = std::make_shared<Entity>();
127 saveEn->position = std::make_pair(257.0, 160.0);
128 saveEn->size = std::make_pair(8.0, 11.0);
129
130 auto save_render = std::make_shared<StaticImageComponent>("../res/keyring.png");
131 saveEn->addComponent(save_render);
132
133 auto save_physics = std::make_shared<PhysicsBodyComponent>();
134 saveEn->addComponent(save_physics);
135
136 auto save_collide = std::make_shared<SimpleColliderComponent>([&] (Entity& collider) {
137 playSound("../res/Pickup_Coin23.wav", 0.25);
138
139 saveGame(map, collider.position);
140 });
141 saveEn->addComponent(save_collide);
142
143 nextEntities.push_back(saveEn);
144 }
145
123 newWorld = true; 146 newWorld = true;
124} 147}
125 148