fixed merge
authorlukel495 <lukel495@su15-111.ad.liu.se>
Tue, 14 Nov 2023 12:58:53 +0000 (13:58 +0100)
committerlukel495 <lukel495@su15-111.ad.liu.se>
Tue, 14 Nov 2023 12:58:53 +0000 (13:58 +0100)
1  2 
assets/ysex.png
src/States.cc
src/States.h

diff --cc assets/ysex.png
index e9c31abc582f198052b4a9dde4b66dff7848cd3c,0000000000000000000000000000000000000000..5663d704c7383e19e05e841b90a9649d645151b1
mode 100644,000000..100644
Binary files differ
diff --cc src/States.cc
index 5a35d060fa7fcd38c08196cc1e6746ea43a5c31b,502efb904855116c6ec399a35770759491bf4ff3..64187f7d3a28c8ef85422ca6fb2dc9a3d613d444
@@@ -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>());
+     bottle_texture.loadFromFile("assets/kir.png");
  }
  
 -void Game_state::update(Contextcontext)
 +void Game_state::update(Context &context)
  {
      if (pause_game)
 -    {   
 -        context.saved_game.reset(static_cast<Game_state*>(context.current_state.release()));
 -        
 +    {
 +        context.saved_game.reset(static_cast<Game_state *>(context.current_state.release()));
 +
          context.next_state = std::make_unique<Pause_menu>();
          pause_game = false;
          return;
          }
      }
      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<Bottle>());
-         // std::cout << "placed bottle"<< std::endl;
+         bottles.push_back(std::make_unique<Bottle>(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 eba4f92a60056094ef6d62f2927d32a547dca808,6b8046045944d25e6348179cc484bb4b20eaef2e..2c39109e5fbf5404996b36153863cae6d88ee5cf
@@@ -36,8 -35,9 +36,10 @@@ private
      std::vector<std::unique_ptr<Bottle>> bottles;
      Map game_map;
      Player player;
 +    Helper helper;
      bool pause_game;
+     sf::Texture bottle_texture;
  };
  
  class Start_menu : public State