From: Nils Forssén Date: Tue, 28 Nov 2023 12:48:39 +0000 (+0100) Subject: Fixed game_over X-Git-Url: https://gitweb.forssennils.se/?a=commitdiff_plain;h=5cd076b884b86ab1b28ca4688d723f283c51afb1;p=TDDC76_proj.git Fixed game_over --- 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