feat: implement ground state movement logic for player character
This commit is contained in:
@@ -79,7 +79,9 @@ func update(delta: float) -> void:
|
||||
vel.y -= params.gravity * delta
|
||||
else:
|
||||
# Snap to floor: small downward velocity keeps is_on_floor() stable
|
||||
vel.y = -0.5
|
||||
# ONLY if we aren't being launched upward by an impulse!
|
||||
if vel.y <= 0.0:
|
||||
vel.y = -0.5
|
||||
|
||||
player.velocity = vel
|
||||
player.move_and_slide()
|
||||
@@ -93,10 +95,11 @@ func update(delta: float) -> void:
|
||||
else:
|
||||
machine.on_ground = false
|
||||
|
||||
# ── Falling off ledge → air state ─────────────────────────────────────
|
||||
if not machine.on_ground and machine.coyote_timer <= 0.0:
|
||||
machine.switch_to("air")
|
||||
return
|
||||
# ── Launch or Falling off ledge → air state ───────────────────────────
|
||||
if not machine.on_ground:
|
||||
if player.velocity.y > 0.0 or machine.coyote_timer <= 0.0:
|
||||
machine.switch_to("air")
|
||||
return
|
||||
|
||||
# ── Wall run check ────────────────────────────────────────────────────
|
||||
var wall_n := machine.detect_wall_horizontal()
|
||||
|
||||
Reference in New Issue
Block a user