From 79ad34dc0f23c3dc24780fd43116fca608539f01 Mon Sep 17 00:00:00 2001 From: Hugo Locurcio Date: Thu, 2 Jul 2020 15:32:17 +0200 Subject: [PATCH] Progressively interrupt the jump in the 2D platformer demo This feels more smooth while still giving a sense of control to the player. --- 2d/platformer/src/Actors/Player.gd | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/2d/platformer/src/Actors/Player.gd b/2d/platformer/src/Actors/Player.gd index fb623f06..436a3be5 100644 --- a/2d/platformer/src/Actors/Player.gd +++ b/2d/platformer/src/Actors/Player.gd @@ -94,7 +94,9 @@ func calculate_move_velocity( if direction.y != 0.0: velocity.y = speed.y * direction.y if is_jump_interrupted: - velocity.y = 0.0 + # Decrease the Y velocity by multiplying it, but don't set it to 0 + # as to not be too abrupt. + velocity.y *= 0.6 return velocity