class_name Fall
+const fall_landing_limit := 3.0
+const fall_roll_limit := 6.0
+
+var landing_type := ""
+
+
+func should_enter(input: InputPacket) -> String:
+ if not player.is_on_floor():
+ input.actions.append("fall")
+ elif not landing_type.is_empty():
+ input.actions.append(landing_type)
+
+ input.actions.sort_custom(moves_priority_sort)
+ return input.actions[0]
+
+
func update(_input: InputPacket, delta: float):
player.velocity += player.get_gravity() * delta
+
+ if abs(player.velocity.y) > fall_landing_limit:
+ if abs(player.velocity.y) > fall_roll_limit:
+ landing_type = "fallToRoll"
+ else:
+ landing_type = "fallToLanding"
+
player.move_and_slide()