]> Untitled Git - frog-ninja.git/blobdiff - player/dash.gd
Fixed up moves
[frog-ninja.git] / player / dash.gd
index c06273425e74c2d8feed31b0f87c2efff31ff30c..6b6368f1b7755e77779a87be5979d8f87b16730b 100644 (file)
@@ -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