diff options
author | Max-001 <maxsmits21@kpnmail.nl> | 2025-01-08 18:55:21 +0100 |
---|---|---|
committer | Max-001 <maxsmits21@kpnmail.nl> | 2025-01-08 18:55:21 +0100 |
commit | 3cc17985b9f3fc666564b5cae36e11ec8beb134a (patch) | |
tree | e48d55a67d142f67c1ebd5a97133657d69b69772 /game/player | |
parent | 4eb68c5f5672ed9b5746cc09249dddc804ebd37d (diff) |
Do not move player if x velocity is 0
Diffstat (limited to 'game/player')
-rw-r--r-- | game/player/PlayerEndScript.cpp | 4 |
1 files changed, 3 insertions, 1 deletions
diff --git a/game/player/PlayerEndScript.cpp b/game/player/PlayerEndScript.cpp index 047dbb0..4ae813f 100644 --- a/game/player/PlayerEndScript.cpp +++ b/game/player/PlayerEndScript.cpp @@ -62,7 +62,9 @@ bool PlayerEndScript::on_collision(const crepe::CollisionEvent & ev) { rb_player.data.angular_velocity = 0; rb_player.data.elasticity_coefficient = 0; - rb_player.data.linear_velocity = vec2(PLAYER_SPEED * dt, 0); + if (rb_player.data.linear_velocity.x != 0) { + rb_player.data.linear_velocity = vec2(PLAYER_SPEED * dt, 0); + } rb_player.data.linear_velocity_coefficient = vec2(0.5, 0.5); rb_camera.data.linear_velocity_coefficient = vec2(0.5, 0.5); for (Animator & anim : anim_player) { |