From 0f80c1f34ab6b526c3a3035c4ac28deebfbf85d0 Mon Sep 17 00:00:00 2001 From: Sergio Date: Tue, 7 Apr 2026 12:10:12 +0200 Subject: [PATCH] =?UTF-8?q?eliminada=20repetici=C3=B3=20en=20la=20tecla=20?= =?UTF-8?q?down?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- source/game/entities/player.cpp | 5 ++++- source/game/entities/player.hpp | 1 + 2 files changed, 5 insertions(+), 1 deletion(-) 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;