extends Node

var player1_device_id = -1
var player2_device_id = -1

func _input(event):
	# Detect which controller is used
	if event is InputEventJoypadButton or event is InputEventJoypadMotion:
		if player1_device_id == -1:
			player1_device_id = event.device  # Assign the first controller to Player 1
			print("Player 1 controller assigned to device: ", event.device)
		elif player2_device_id == -1 and event.device != player1_device_id:
			player2_device_id = event.device  # Assign the second controller to Player 2
			print("Player 2 controller assigned to device: ", event.device)
