From 5203994b55aa51d5034c30001e0dac66efe2f14b Mon Sep 17 00:00:00 2001 From: Max-001 Date: Fri, 10 Jan 2025 14:44:42 +0100 Subject: Fixed issue that Player is lifted up when any key is pressed --- game/player/PlayerScript.cpp | 12 ++++++++---- 1 file changed, 8 insertions(+), 4 deletions(-) diff --git a/game/player/PlayerScript.cpp b/game/player/PlayerScript.cpp index c3843ca..286cdaf 100644 --- a/game/player/PlayerScript.cpp +++ b/game/player/PlayerScript.cpp @@ -30,14 +30,18 @@ void PlayerScript::init() { } bool PlayerScript::on_key_down(const KeyPressEvent & ev) { - const vec2 UP = {0, -1}; - this->help_kick(UP); + if (ev.key == Keycode::SPACE) { + const vec2 UP = {0, -1}; + this->help_kick(UP); + } return false; } bool PlayerScript::on_key_up(const KeyReleaseEvent & ev) { - const vec2 DOWN = {0, 1}; - this->help_kick(DOWN); + if (ev.key == Keycode::SPACE) { + const vec2 DOWN = {0, 1}; + this->help_kick(DOWN); + } return false; } -- cgit v1.2.3