Browse Source

Merge pull request #494 from Calinou/2d-platformer-progressive-jump-interrupt

Progressively interrupt the jump in the 2D platformer demo
Aaron Franke 5 years ago
parent
commit
b99cd953d2
1 changed files with 3 additions and 1 deletions
  1. 3 1
      2d/platformer/src/Actors/Player.gd

+ 3 - 1
2d/platformer/src/Actors/Player.gd

@@ -94,7 +94,9 @@ func calculate_move_velocity(
 	if direction.y != 0.0:
 	if direction.y != 0.0:
 		velocity.y = speed.y * direction.y
 		velocity.y = speed.y * direction.y
 	if is_jump_interrupted:
 	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
 	return velocity