diff --git a/source/game/entities/player.cpp b/source/game/entities/player.cpp index 05c9969..81170ca 100644 --- a/source/game/entities/player.cpp +++ b/source/game/entities/player.cpp @@ -110,7 +110,10 @@ void Player::handleInput() { const bool JUMP_PRESSED = Input::get()->checkAction(InputAction::JUMP); wanna_jump_ = JUMP_PRESSED && !jump_held_; jump_held_ = JUMP_PRESSED; - wanna_down_ = Input::get()->checkAction(InputAction::DOWN); + + const bool DOWN_PRESSED = Input::get()->checkAction(InputAction::DOWN); + wanna_down_ = DOWN_PRESSED && !down_held_; + down_held_ = DOWN_PRESSED; } // ============================================================================ diff --git a/source/game/entities/player.hpp b/source/game/entities/player.hpp index c6e1a39..0f8f7b2 100644 --- a/source/game/entities/player.hpp +++ b/source/game/entities/player.hpp @@ -100,6 +100,7 @@ class Player { bool wanna_jump_ = false; bool wanna_down_ = false; bool jump_held_ = false; + bool down_held_ = false; // --- Estado --- State state_ = State::ON_GROUND;