From 5cd076b884b86ab1b28ca4688d723f283c51afb1 Mon Sep 17 00:00:00 2001 From: =?utf8?q?Nils=20Forss=C3=A9n?= Date: Tue, 28 Nov 2023 13:48:39 +0100 Subject: [PATCH] Fixed game_over --- src/States.cc | 15 +-------------- src/States.h | 2 -- 2 files changed, 1 insertion(+), 16 deletions(-) diff --git a/src/States.cc b/src/States.cc index 9efb67e..8616186 100644 --- a/src/States.cc +++ b/src/States.cc @@ -14,7 +14,6 @@ using json = nlohmann::json; Game_state::Game_state() : game_map{}, pause_game{false}, - gameover{false}, player{}, bottles{}, helper{}, @@ -62,7 +61,7 @@ void Game_state::update(Context &context) int remaining_time {static_cast(data["game_constants"]["game_time"]) - static_cast(game_time)}; if (remaining_time < 0) { - context.next_state = std::make_unique(); + context.next_state = std::make_unique(); return; } @@ -145,13 +144,6 @@ void Game_state::update(Context &context) bike->update(context); } - if (gameover) - { - context.next_state = std::make_unique(); - gameover = false; - return; - } - } void Game_state::render(sf::RenderWindow &window) const @@ -188,11 +180,6 @@ void Game_state::handle_input(sf::Event &event) pause_game = true; return; break; - - case sf::Keyboard::T: - gameover = true; - break; - default: break; } diff --git a/src/States.h b/src/States.h index 450f049..9e7505c 100644 --- a/src/States.h +++ b/src/States.h @@ -63,8 +63,6 @@ private: json data; int points; - - bool gameover; }; class Start_menu : public State -- 2.30.2