diff --git a/sources/Models/GameState.hpp b/sources/Models/GameState.hpp index 4bb271b5..cc521c00 100644 --- a/sources/Models/GameState.hpp +++ b/sources/Models/GameState.hpp @@ -26,6 +26,7 @@ namespace BBM LobbyScene, TitleScreenScene, CreditScene, + ScoreScene = MainMenuScene, }; diff --git a/sources/Runner/GameScene.cpp b/sources/Runner/GameScene.cpp index 3743f559..670e220a 100644 --- a/sources/Runner/GameScene.cpp +++ b/sources/Runner/GameScene.cpp @@ -22,6 +22,7 @@ #include "Drawables/2D/Text.hpp" #include "Component/Gravity/GravityComponent.hpp" #include "Component/BumperTimer/BumperTimerComponent.hpp" +#include "Component/Timer/TimerComponent.hpp" #include "Model/Model.hpp" #include "Map/Map.hpp" #include "Component/Score/ScoreComponent.hpp" @@ -42,6 +43,10 @@ namespace BBM {SoundComponent::BOMB, "assets/sounds/bomb_drop.ogg"}, //{SoundComponent::DEATH, "assets/sounds/death.ogg"} }; + scene->addEntity("Timer") + .addComponent(std::chrono::seconds(60), [](WAL::Entity &, WAL::Wal &) { + Runner::gameState.nextScene = GameState::ScoreScene; + }); scene->addEntity("player") .addComponent(0, 1.01, 0) .addComponent("assets/player/player.iqm", true, std::make_pair(MAP_DIFFUSE, "assets/player/blue.png")) diff --git a/sources/System/EndCondition/EndConditionSystem.cpp b/sources/System/EndCondition/EndConditionSystem.cpp index a34defa8..655322d3 100644 --- a/sources/System/EndCondition/EndConditionSystem.cpp +++ b/sources/System/EndCondition/EndConditionSystem.cpp @@ -16,6 +16,6 @@ namespace BBM { for (auto & [_ , healthComponent]: this->_wal.getScene()->view()) alivePlayersCount += (healthComponent.getHealthPoint() != 0); if (alivePlayersCount <= 1) - Runner::gameState.nextScene = Runner::gameState.MainMenuScene; + Runner::gameState.nextScene = Runner::gameState.ScoreScene; } } \ No newline at end of file