From bdf50ff543c73c83cc7a06426bc2a6fe66616b87 Mon Sep 17 00:00:00 2001 From: Kelly Rauchenberger Date: Fri, 13 Mar 2015 14:02:07 -0400 Subject: Added a checkpoint --- src/game.cpp | 23 +++++++++++++++++++++++ 1 file changed, 23 insertions(+) (limited to 'src/game.cpp') 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) nextEntities.push_back(mapEn); nextEntities.push_back(player); + // this is cheating but is just for testing + if (&map == &m2) + { + auto saveEn = std::make_shared(); + saveEn->position = std::make_pair(257.0, 160.0); + saveEn->size = std::make_pair(8.0, 11.0); + + auto save_render = std::make_shared("../res/keyring.png"); + saveEn->addComponent(save_render); + + auto save_physics = std::make_shared(); + saveEn->addComponent(save_physics); + + auto save_collide = std::make_shared([&] (Entity& collider) { + playSound("../res/Pickup_Coin23.wav", 0.25); + + saveGame(map, collider.position); + }); + saveEn->addComponent(save_collide); + + nextEntities.push_back(saveEn); + } + newWorld = true; } -- cgit 1.4.1