This repository has been archived on 2026-05-07. You can view files and clone it. You cannot open issues or pull requests or push a commit.
Files
instructions-clear/scripts/runner_input.gd
T

17 lines
647 B
GDScript

extends MultiplayerSynchronizer
var move_direction: Vector2
func _ready() -> void:
move_direction = Vector2.ZERO
if multiplayer.is_server() or get_multiplayer_authority() != multiplayer.get_unique_id():
set_process(false)
set_physics_process(false)
return
func _physics_process(_delta: float) -> void:
var directional_input := Input.get_vector("move_right", "move_left", "move_forward", "move_back")
var camera_adjusted: Vector3 = (directional_input.x * %RunnerCameraTarget.global_basis.z) + (directional_input.y * %RunnerCameraTarget.global_basis.x)
move_direction = Vector2(camera_adjusted.x, camera_adjusted.z).rotated(PI / 2.0)