aboutsummaryrefslogtreecommitdiff
path: root/game/player
diff options
context:
space:
mode:
authorMax-001 <maxsmits21@kpnmail.nl>2025-01-08 20:07:39 +0100
committerMax-001 <maxsmits21@kpnmail.nl>2025-01-08 20:07:39 +0100
commitf189777141024bbad518c921587f15672b1982c2 (patch)
treeedde0e468b3728ff582623eacc48b96a6b36e2e4 /game/player
parent3cc17985b9f3fc666564b5cae36e11ec8beb134a (diff)
Added check to not walk if velocity is 0
Diffstat (limited to 'game/player')
-rw-r--r--game/player/PlayerScript.cpp4
1 files changed, 3 insertions, 1 deletions
diff --git a/game/player/PlayerScript.cpp b/game/player/PlayerScript.cpp
index 57819c0..fadca9c 100644
--- a/game/player/PlayerScript.cpp
+++ b/game/player/PlayerScript.cpp
@@ -2,6 +2,7 @@
#include "../Config.h"
#include "../enemy/BattleScript.h"
+
#include <crepe/api/Animator.h>
#include <crepe/api/AudioSource.h>
#include <crepe/api/BoxCollider.h>
@@ -126,7 +127,8 @@ void PlayerScript::fixed_update(crepe::duration_t dt) {
current_jetpack_sound = 0;
}
} else if (transform.position.y == 195) {
- if (prev_anim != 0) {
+ Rigidbody & rb = this->get_components_by_name<Rigidbody>("player").front();
+ if (prev_anim != 0 && rb.data.linear_velocity.x != 0) {
for (Animator & anim : animators) {
anim.active = true;
anim.set_anim(0);