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