Hey ya'll!
I've recently started learning Godot and I'm going through a multiplayer tutorial. Some of the controls I had to figure out on my own such as getting weapon aim to work off of the right analog stick. The tutorial is great and the game server/client all connect and everything works for the most part. The issue I'm running into is very strange.....When I move with the keyboard the movement of the players syncs up perfectly fine, but when I use the controller it moves both players. Has anyone run into this and know what's causing it? I've looked through the input manager and nothing seems to be all that different from what was set automatically. Here is the code for the movement and aiming.
`var gravity = ProjectSettings.get_setting("physics/2d/default_gravity")
@export var bullet 😛ackedScene
func _ready():
$MultiplayerSynchronizer.set_multiplayer_authority(str(name).to_int())
func _physics_process(delta):
if $MultiplayerSynchronizer.get_multiplayer_authority() == multiplayer.get_unique_id():
if not is_on_floor():
velocity.y += gravity * delta
if (Input.is_action_just_pressed("ui_accept") or Input.is_joy_button_pressed(0,JOY_BUTTON_A)) and is_on_floor():
velocity.y = JUMP_VELOCITY
var direction = Input.get_axis("ui_left", "ui_right")
if direction:
velocity.x = direction * SPEED
else:
velocity.x = move_toward(velocity.x, 0, SPEED)
# get analog stick direction
var input_vector = Vector2(0, 0);
input_vector.x = Input.get_action_strength("aim_right") - Input.get_action_strength("aim_left")
input_vector.y = Input.get_action_strength("aim_down") - Input.get_action_strength("aim_up")
input_vector = input_vector.normalized()
$AttackRotation.rotation = input_vector.angle()
if Input.is_action_just_pressed("fire_weapon"):
var b = bullet.instantiate()
b.global_position = $AttackRotation/BulletSpawn.global_position
b.rotation_degrees = $AttackRotation.rotation_degrees
get_tree().root.add_child(b)
move_and_slide()`