added yf time to json Nils Lukas Arvid Stina
authorlukel495 <lukel495@su15-110.ad.liu.se>
Mon, 27 Nov 2023 07:57:32 +0000 (08:57 +0100)
committerlukel495 <lukel495@su15-110.ad.liu.se>
Mon, 27 Nov 2023 07:57:32 +0000 (08:57 +0100)
assets/data.json
src/States.cc

index 7e8b395b76b59a6bdc5ac7528c13a64f06830407..ecbd6def66d8727e10e97ece2682617d6ff419c5 100644 (file)
@@ -28,7 +28,8 @@
     "game_constants":
     {
         "bottles_per_second" : 2,
-        "game_time" : 20
+        "game_time" : 20,
+        "yf_per_second": 0.125
         
     },
     "map":
index af793b734dff5fc8b448830a2c5d7d4a66e1fc27..48ac63fe4a8598cfaeb94c9f5e735d5b946c5074 100644 (file)
@@ -105,7 +105,7 @@ void Game_state::update(Context &context)
         bottles.push_back(std::make_unique<Bottle>(bottle_texture, data["bottle"]));
         time_since_last_bottle = 0;
     }
-    if (time_since_last_yf >= 8)
+    if (time_since_last_yf >= 1 / static_cast<float>(data["game_constants"]["yf_per_second"]))
     {
         yf.push_back(std::make_unique<YF>(YF_texture));
         if(yf.size() > 1)