extends Node var file func _init(event): if event is InputEventKey || event is InputEventMouse: Global.gamepad = 0 elif str(Input.get_joy_name(0)).begins_with("Nintendo Switch"): Global.gamepad = 2 elif str(Input.get_joy_name(0)).begins_with("Sony Computer Entertainment") || str(Input.get_joy_name(0)).begins_with("PS4") || str(Input.get_joy_name(0)).begins_with("PS5"): Global.gamepad = 3 elif !str(Input.get_joy_name(0)).is_empty(): Global.gamepad = 1 if event is InputEventMouse: Input.set_mouse_mode(Input.MOUSE_MODE_VISIBLE) else: Input.set_mouse_mode(Input.MOUSE_MODE_HIDDEN)