From: lukel495 Date: Tue, 14 Nov 2023 12:58:53 +0000 (+0100) Subject: fixed merge X-Git-Url: https://gitweb.forssennils.se/?a=commitdiff_plain;h=d90f11e32ceb9e155b5cca776a3f732c168c09b6;p=TDDC76_proj.git fixed merge --- d90f11e32ceb9e155b5cca776a3f732c168c09b6 diff --cc assets/ysex.png index e9c31ab,0000000..5663d70 mode 100644,000000..100644 Binary files differ diff --cc src/States.cc index 5a35d06,502efb9..64187f7 --- a/src/States.cc +++ b/src/States.cc @@@ -5,18 -5,17 +5,17 @@@ #include "Context.h" #include "constants.h" - Game_state::Game_state() : game_map{}, player{}, helper{}, pause_game{false}, bottles{}, time_since_last_bottle{0.0f} + Game_state::Game_state() : game_map{}, player{}, pause_game{false}, bottles{}, time_since_last_bottle{0.0f}, bottle_texture {} { - - bottles.push_back(std::make_unique()); + bottle_texture.loadFromFile("assets/kir.png"); } -void Game_state::update(Context& context) +void Game_state::update(Context &context) { if (pause_game) - { - context.saved_game.reset(static_cast(context.current_state.release())); - + { + context.saved_game.reset(static_cast(context.current_state.release())); + context.next_state = std::make_unique(); pause_game = false; return; @@@ -42,17 -41,13 +41,12 @@@ } } time_since_last_bottle += context.time.asSeconds(); - // std::cout << std::fixed << std::setprecision(3) << time_since_last_bottle << std::endl; + std::cout << std::fixed << std::setprecision(3) << time_since_last_bottle << std::endl; if (time_since_last_bottle >= 2) { - if (bottles.size() > 10) - { - bottles.erase(bottles.begin()); - } - - bottles.push_back(std::make_unique()); - // std::cout << "placed bottle"<< std::endl; + bottles.push_back(std::make_unique(bottle_texture)); + std::cout << "placed bottle"<< std::endl; time_since_last_bottle = 0; - } game_map.update(context); player.update(context); diff --cc src/States.h index eba4f92,6b80460..2c39109 --- a/src/States.h +++ b/src/States.h @@@ -36,8 -35,9 +36,10 @@@ private std::vector> bottles; Map game_map; Player player; + Helper helper; bool pause_game; + sf::Texture bottle_texture; + }; class Start_menu : public State