limbo hsm

This commit is contained in:
2026-10-15 16:56:45 +08:00
parent 18e7b2daa8
commit a76c4aebef
30 changed files with 665 additions and 121 deletions
+20
View File
@@ -0,0 +1,20 @@
extends LimboState
## 上升段:播 jump。越过顶点(vy ≤ 0)转 Fall。
## 水平目标速度保持离地前的值 —— 空中加速度本来就小(air_acceleration),
## 不由本状态改写。
func _enter() -> void:
(get_agent() as Player).animation_player.play_state(PlayerAnimator.AnimState.JUMP)
func _update(_delta: float) -> void:
var player := get_agent() as Player
if player == null:
return
# 落地判定带 vy ≤ 0 门槛:起跳那一帧 is_on_floor() 还是 true
# (要等 move_and_slide() 之后才翻假),没有门槛会当帧弹回地面状态。
if player.is_on_floor() and player.velocity.y <= 0.0:
dispatch(&"landed")
return
if player.velocity.y <= 0.0:
dispatch(&"falling")