extends MultiplayerSynchronizer @export var jumping := false @export var input_direction := Vector2() @onready var camera_mount = $"../FirstPersonCameraMount" @onready var placeholder = $".." func _ready() -> void: pass #set_process(get_multiplayer_authority() == multiplayer.get_unique_id()) # Called every frame. 'delta' is the elapsed time since the previous frame. func _process(delta: float) -> void: # Add the gravity. if multiplayer.get_unique_id() == get_multiplayer_authority(): input_direction = Input.get_vector("move_left", "move_right", "move_forward", "move_backwards") set_input_direction.rpc(input_direction) if Input.is_action_just_pressed("jump"): jump.rpc_id(1) var camera_sens: float = 0.002 func _input(event): if multiplayer.get_unique_id() == get_multiplayer_authority(): if event is InputEventMouseMotion and Input.mouse_mode == Input.MOUSE_MODE_CAPTURED: placeholder.rotate_y(-event.relative.x * camera_sens) @rpc("any_peer", "call_local", "reliable") func set_input_direction(direction: Vector2): input_direction = direction @rpc("any_peer", "call_local", "reliable") func jump(): jumping = true