fixed yf, stina arvid
authorstian853 <stian853@su15-111.ad.liu.se>
Mon, 27 Nov 2023 07:43:50 +0000 (08:43 +0100)
committerstian853 <stian853@su15-111.ad.liu.se>
Mon, 27 Nov 2023 07:43:50 +0000 (08:43 +0100)
src/States.cc

index 95cba1422cc889e1a5448cb84290716dbc36e054..7cc5c5d40977f3e09abb829d5a8830861b60a762 100644 (file)
@@ -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>(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>(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);