diff --git a/.tasks b/.tasks index ef1996a..6a001fa 100644 --- a/.tasks +++ b/.tasks @@ -1,6 +1,6 @@ [generate] -command=cmake -DCMAKE_BUILD_TYPE=Debug -DCMAKE_EXPORT_COMPILE_COMMANDS=1 .. +command=cmake -DCMAKE_BUILD_TYPE=Release -DCMAKE_EXPORT_COMPILE_COMMANDS=1 .. cwd=build [build] diff --git a/game/world.cpp b/game/world.cpp index 62b2e91..12bc6f1 100644 --- a/game/world.cpp +++ b/game/world.cpp @@ -137,10 +137,9 @@ void world::update(sf::Time dt) { if (won()) { sf::Color opacity = m_space_to_retry.getColor(); - int alpha = opacity.a; - alpha += 255.f * dt.asSeconds(); - alpha = std::min(255, alpha); - opacity.a = alpha; + m_victory_alpha += 255.f * dt.asSeconds(); + m_victory_alpha = std::min(255.f, m_victory_alpha); + opacity.a = m_victory_alpha; m_space_to_retry.setColor(opacity); m_game_clear.setColor(opacity); if (m_just_jumped()) { @@ -699,8 +698,9 @@ void world::draw(sf::RenderTarget& t, sf::RenderStates s) const { void world::m_player_win() { if (m_touched_goal) return; - m_touched_goal = true; - m_dashing = false; + m_touched_goal = true; + m_victory_alpha = 0; + m_dashing = false; m_space_to_retry.setColor(sf::Color(255, 255, 255, 0)); m_game_clear.setColor(sf::Color(255, 255, 255, 0)); m_r.play_sound("victory"); diff --git a/game/world.hpp b/game/world.hpp index 5e5ac0c..bc6367f 100644 --- a/game/world.hpp +++ b/game/world.hpp @@ -43,6 +43,7 @@ class world : public sf::Drawable, public sf::Transformable { // messages shown on victory sf::Sprite m_game_clear; sf::Sprite m_space_to_retry; + float m_victory_alpha; // PLAYER DATA //