This commit is contained in:
Spencer Killen 2022-12-11 17:10:07 -07:00
parent 98c0177df2
commit 04cec5149a
Signed by: sjkillen
GPG Key ID: F307025B65C860BA
2 changed files with 12 additions and 3 deletions

View File

@ -3,11 +3,16 @@ extends Node
var played_takeoff: bool = false var played_takeoff: bool = false
var falling: bool = false var falling: bool = false
var measure = 0.0
func jump(): func jump():
var phys = $"../OnFootPhysics" var phys = $"../OnFootPhysics"
var on_floor = $"../OnFootPhysics/Floor".is_on_floor var on_floor = $"../OnFootPhysics/Floor".is_on_floor
var jump_intent = $"../MovementInput".jump_intent 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: if jump_intent and not on_floor and not played_takeoff:
$Jump.play() $Jump.play()
played_takeoff = true played_takeoff = true
@ -15,15 +20,13 @@ func jump():
if phys.just_landed: if phys.just_landed:
$Jump.stop() $Jump.stop()
played_takeoff = false 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") $CameraAnimation.play("jump_landing")
var landing_playing = $JumpLanding.playing or $JumpLandingHardCrunch.playing or $JumpLandingHardOuch.playing var landing_playing = $JumpLanding.playing or $JumpLandingHardCrunch.playing or $JumpLandingHardOuch.playing
if not landing_playing: if not landing_playing:
if not phys.just_landed_terminally: if not phys.just_landed_terminally:
print("a")
$JumpLanding.play() $JumpLanding.play()
else: else:
print("b")
$JumpLandingHardCrunch.play() $JumpLandingHardCrunch.play()
$JumpLandingHardOuch.play() $JumpLandingHardOuch.play()

View File

@ -24,8 +24,10 @@ var target_velocity: Vector3 = Vector3.ZERO
var is_jumping: bool = false var is_jumping: bool = false
var jump_permission: float = 1.0 var jump_permission: float = 1.0
var is_falling: bool = false var is_falling: bool = false
var is_falling_medium = false
var is_falling_terminally: bool = false var is_falling_terminally: bool = false
var just_landed: bool = false var just_landed: bool = false
var just_landed_medium: bool = false
var just_landed_terminally: bool = false var just_landed_terminally: bool = false
func get_terminal_falling_velocity(): func get_terminal_falling_velocity():
@ -94,12 +96,16 @@ func process_falling():
is_falling = true is_falling = true
just_landed = false just_landed = false
just_landed_terminally = false just_landed_terminally = false
if velocity.y <= 5.0:
is_falling_medium = true
if is_falling_velocity_terminal(): if is_falling_velocity_terminal():
is_falling_terminally = true is_falling_terminally = true
return return
just_landed = is_falling just_landed = is_falling
just_landed_medium = is_falling_medium
just_landed_terminally = is_falling_terminally just_landed_terminally = is_falling_terminally
is_falling = false is_falling = false
is_falling_medium = false
is_falling_terminally = false is_falling_terminally = false