summary refs log tree commit diff stats
path: root/src/game.cpp
diff options
context:
space:
mode:
authorKelly Rauchenberger <fefferburbia@gmail.com>2015-03-13 14:02:07 -0400
committerKelly Rauchenberger <fefferburbia@gmail.com>2015-03-13 14:02:07 -0400
commitbdf50ff543c73c83cc7a06426bc2a6fe66616b87 (patch)
tree6d789280fa0829ec32cc37ce73a2773d4a5cd9d1 /src/game.cpp
parent9cf2d327476d00b696254b170c03dd6b8548e1d0 (diff)
downloadtherapy-bdf50ff543c73c83cc7a06426bc2a6fe66616b87.tar.gz
therapy-bdf50ff543c73c83cc7a06426bc2a6fe66616b87.tar.bz2
therapy-bdf50ff543c73c83cc7a06426bc2a6fe66616b87.zip
Added a checkpoint
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