aboutsummaryrefslogtreecommitdiff
path: root/game/player/PlayerEndScript.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'game/player/PlayerEndScript.cpp')
-rw-r--r--game/player/PlayerEndScript.cpp7
1 files changed, 5 insertions, 2 deletions
diff --git a/game/player/PlayerEndScript.cpp b/game/player/PlayerEndScript.cpp
index 047dbb0..62fd350 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) {
@@ -90,8 +92,9 @@ bool PlayerEndScript::on_collision(const crepe::CollisionEvent & ev) {
jump++;
}
- if (rb_player.data.linear_velocity.x < 5 && jump >= 3) {
+ if (rb_player.data.linear_velocity.x < 5 && jump == 3) {
this->trigger_event<EndGameEvent>();
+ jump++;
}
return false;