Răsfoiți Sursa

On jump input, immediately increase airborne time to MIN_AIRBORNE_TIME.

This is necessary, otherwise the frame after jumping it's possible that
on_air will be unset due to airborne time being less than
MIN_AIRBORNE_TIME. This causes jumps to feel sluggish since the player's
horizontal speed gets lowered.
Daniel 5 ani în urmă
părinte
comite
93628510ce
1 a modificat fișierele cu 2 adăugiri și 0 ștergeri
  1. 2 0
      player/player.gd

+ 2 - 0
player/player.gd

@@ -108,6 +108,8 @@ func _physics_process(delta):
 	if not on_air and Input.is_action_just_pressed("jump"):
 	if not on_air and Input.is_action_just_pressed("jump"):
 		velocity.y = JUMP_SPEED
 		velocity.y = JUMP_SPEED
 		on_air = true
 		on_air = true
+		# Increase airborne time so next frame on_air is still true
+		airborne_time = MIN_AIRBORNE_TIME
 		animation_tree["parameters/state/current"] = 2
 		animation_tree["parameters/state/current"] = 2
 		sound_effect_jump.play()
 		sound_effect_jump.play()