From 3cc17985b9f3fc666564b5cae36e11ec8beb134a Mon Sep 17 00:00:00 2001 From: Max-001 Date: Wed, 8 Jan 2025 18:55:21 +0100 Subject: Do not move player if x velocity is 0 --- game/player/PlayerEndScript.cpp | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) (limited to 'game/player') 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) { -- cgit v1.2.3