]> Untitled Git - frog-ninja.git/blob - player/dash.gd
Fixed up moves
[frog-ninja.git] / player / dash.gd
1 extends Move
2 class_name Dash
3
4
5 func should_enter(input) -> String:
6         input.actions.sort_custom(moves_priority_sort)
7         return input.actions[0]
8
9
10 func update(input: InputPacket, _delta: float):
11         # Get the XZ input direction based on player's input relative to the camera
12         var forward := camera.global_basis.z
13         var right := camera.global_basis.x
14         var move_direction := (
15                 forward * input.movement_direction.y + right * input.movement_direction.x
16                 ).normalized()
17         move_direction.y = 0
18
19         # TODO: check if new_pos is valid!
20         var new_pos := player.last_movement_direction * player.dash_length
21         player.global_position += new_pos