From c0b0f6d509681a979d22f57277a50a314771b2ee Mon Sep 17 00:00:00 2001 From: stian853 Date: Mon, 27 Nov 2023 08:43:50 +0100 Subject: [PATCH] fixed yf, stina arvid --- src/States.cc | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) diff --git a/src/States.cc b/src/States.cc index 95cba14..7cc5c5d 100644 --- a/src/States.cc +++ b/src/States.cc @@ -76,18 +76,20 @@ void Game_state::update(Context &context) } time_since_last_bottle += context.time.asSeconds(); time_since_last_yf += context.time.asSeconds(); - //std::cout << std::fixed << std::setprecision(3) << time_since_last_bottle << std::endl; if (time_since_last_bottle >= data["game_constants"]["bottles_per_second"]) { bottles.push_back(std::make_unique(bottle_texture, data["bottle"])); - //std::cout << "placed bottle"<< std::endl; time_since_last_bottle = 0; } - if (time_since_last_yf >= 5) + if (time_since_last_yf >= 8) { yf.push_back(std::make_unique(YF_texture)); - std::cout << "yf spawned"<< std::endl; + if(yf.size() > 1) + { + yf.erase(yf.begin()); + } time_since_last_yf = 0; + } game_map.update(context); player->update(context); -- 2.30.2