changed speed when heavy
authorNils Forssén <nilfo359@student.liu.se>
Tue, 12 Dec 2023 10:38:17 +0000 (11:38 +0100)
committerNils Forssén <nilfo359@student.liu.se>
Tue, 12 Dec 2023 10:38:17 +0000 (11:38 +0100)
play
src/Player.cc
src/_test.cc

diff --git a/play b/play
index e382014e2f7e7ba15617d70545ea81949c51c05e..8770e09ac3ec158863f92fc406ec040093f79844 100755 (executable)
Binary files a/play and b/play differ
index 670f05e29ee2fb2425715576b86ee49df5851747..4ef8b168845aa2a6da2f35a7ffdccae8afee2a2b 100644 (file)
@@ -3,6 +3,7 @@
 #include "Player.h"
 #include "Context.h"
 #include "constants.h"
+#include <iostream>
 
 Player::Player(sf::Texture& player_txtr, sf::Texture& sack_txtr, json& params):
     collected{0},
@@ -161,7 +162,9 @@ void Player::handle_input(sf::Event& event)
 void Player::add_collected()
 {
     collected += 1;
+    max_speed *= 0.9;
 }
+
 int Player::get_collected()
 {
     return collected;
@@ -169,5 +172,8 @@ int Player::get_collected()
 
 void Player::zero_collected()
 {
+    std::cout << max_speed << std::endl;
+    max_speed /= pow(0.9, collected);
+    
     collected = 0;
 }
index bcc4ffc34f1790e9232b7c0b8e38dabdf51c0f7e..9a3c50f1e45d5a9b32ca525301d81045ef520689 100644 (file)
@@ -27,8 +27,8 @@ TEST_CASE("functions")
 
         std::ifstream f("assets/data_test.json");
         json test_data = json::parse(f);
-
         game_context.current_state = std::make_unique<Start_menu>(test_data);
+        f.close();
 
         sf::Texture helper_texture;
         helper_texture.loadFromFile(test_data["game_state_assets"]["helper_file"]);