From c8787846c36d72b355b943528c93dcdf0de22e4a Mon Sep 17 00:00:00 2001 From: Crizomb Date: Sun, 15 Jun 2025 19:33:29 +0200 Subject: [PATCH] changement humeur carrote avec scoremultiplier --- SimpleGame/src/Include/Carrot.hpp | 2 ++ SimpleGame/src/Source/Game.cpp | 8 ++++++++ 2 files changed, 10 insertions(+) diff --git a/SimpleGame/src/Include/Carrot.hpp b/SimpleGame/src/Include/Carrot.hpp index 04aec96..5486351 100644 --- a/SimpleGame/src/Include/Carrot.hpp +++ b/SimpleGame/src/Include/Carrot.hpp @@ -22,6 +22,8 @@ public: void setPosition(sf::Vector2f); void setScale(sf::Vector2f); void changeState(CarrotState new_state); + + CarrotState getState() const { return carrotState; }; }; static std::vector ANGRY_PATHS = { diff --git a/SimpleGame/src/Source/Game.cpp b/SimpleGame/src/Source/Game.cpp index 26ddce7..41de2d4 100644 --- a/SimpleGame/src/Source/Game.cpp +++ b/SimpleGame/src/Source/Game.cpp @@ -157,4 +157,12 @@ void Game::update_scores(bool good_action) { ScoreText.setString(std::format("Score = {}", score)); ScoreMultiplierText.setString( std::format("ScoreMultiplier = {}", score_multiplier)); + + if (score_multiplier < 5) { + carrot.changeState(Angry); + } else if (score_multiplier < 10) { + carrot.changeState(Neutral); + } else { + carrot.changeState(Happy); + } }