diff --git a/godot/effects/player/MovementSoundsAnimations.gd b/godot/effects/player/MovementSoundsAnimations.gd index 36155eb..919b007 100644 --- a/godot/effects/player/MovementSoundsAnimations.gd +++ b/godot/effects/player/MovementSoundsAnimations.gd @@ -3,11 +3,16 @@ extends Node var played_takeoff: bool = false var falling: bool = false +var measure = 0.0 + func jump(): var phys = $"../OnFootPhysics" var on_floor = $"../OnFootPhysics/Floor".is_on_floor var jump_intent = $"../MovementInput".jump_intent + measure = min(measure, phys.velocity.y) + print(measure) + if jump_intent and not on_floor and not played_takeoff: $Jump.play() played_takeoff = true @@ -15,15 +20,13 @@ func jump(): if phys.just_landed: $Jump.stop() played_takeoff = false - if $"../OnFootPhysics".velocity.y < -3.0 and not $CameraAnimation.is_playing(): + if phys.just_landed_medium and not $CameraAnimation.is_playing(): $CameraAnimation.play("jump_landing") var landing_playing = $JumpLanding.playing or $JumpLandingHardCrunch.playing or $JumpLandingHardOuch.playing if not landing_playing: if not phys.just_landed_terminally: - print("a") $JumpLanding.play() else: - print("b") $JumpLandingHardCrunch.play() $JumpLandingHardOuch.play() diff --git a/godot/player/OnFootPhysics.gd b/godot/player/OnFootPhysics.gd index d510389..6a0cec8 100644 --- a/godot/player/OnFootPhysics.gd +++ b/godot/player/OnFootPhysics.gd @@ -24,8 +24,10 @@ var target_velocity: Vector3 = Vector3.ZERO var is_jumping: bool = false var jump_permission: float = 1.0 var is_falling: bool = false +var is_falling_medium = false var is_falling_terminally: bool = false var just_landed: bool = false +var just_landed_medium: bool = false var just_landed_terminally: bool = false func get_terminal_falling_velocity(): @@ -94,12 +96,16 @@ func process_falling(): is_falling = true just_landed = false just_landed_terminally = false + if velocity.y <= 5.0: + is_falling_medium = true if is_falling_velocity_terminal(): is_falling_terminally = true return just_landed = is_falling + just_landed_medium = is_falling_medium just_landed_terminally = is_falling_terminally is_falling = false + is_falling_medium = false is_falling_terminally = false