]> Untitled Git - frog-ninja.git/blobdiff - player/moves/fall.gd
Moved camera vector stuff into CameraHandler
[frog-ninja.git] / player / moves / fall.gd
index 034f41ffae1ae3fb99542b134ebe283ef9021564..0330e7c032f90d91c6304e022d92f334749defa4 100644 (file)
@@ -2,10 +2,29 @@ extends Move
 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.player_actions.append("fall")
+       elif not landing_type.is_empty():
+               input.player_actions.append(landing_type)
+               
+       input.player_actions.sort_custom(moves_priority_sort)
+       return input.player_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()
-
-
-func on_enter_state():
-       player.skin.transition_falling()