X-Git-Url: http://git.purplebirdman.com/frog-ninja.git/blobdiff_plain/16f5fda45ed2a668758450eff052e0903d7ef3ae..47f9406a184d838e4701978a1a6f2dd871326d51:/player/dash.gd diff --git a/player/dash.gd b/player/dash.gd index c062734..6b6368f 100644 --- a/player/dash.gd +++ b/player/dash.gd @@ -7,5 +7,15 @@ func should_enter(input) -> String: return input.actions[0] -func update(input: InputPacket, delta: float): - player.move_and_slide() +func update(input: InputPacket, _delta: float): + # Get the XZ input direction based on player's input relative to the camera + var forward := camera.global_basis.z + var right := camera.global_basis.x + var move_direction := ( + forward * input.movement_direction.y + right * input.movement_direction.x + ).normalized() + move_direction.y = 0 + + # TODO: check if new_pos is valid! + var new_pos := player.last_movement_direction * player.dash_length + player.global_position += new_pos