extends VBoxContainer export var joypad_index = 0 # Called when the node enters the scene tree for the first time. func _ready() -> void: pass # Replace with function body. const color_off = Color.blue const color_on = Color.white var id_left = 0 var id_down = 1 var id_up = 2 var id_right = 3 var id_start = 4 var id_back = 5 func set_name(name): $Label.text = name # Called every frame. 'delta' is the elapsed time since the previous frame. func _process(delta: float) -> void: var left = Input.get_joy_axis(joypad_index, id_left) var down = Input.get_joy_axis(joypad_index, id_down) var up = Input.get_joy_axis(joypad_index, id_up) var right = Input.get_joy_axis(joypad_index, id_right) var start = Input.get_joy_axis(joypad_index, id_start) var back = Input.get_joy_axis(joypad_index, id_back) var precision = "%.05f" $Grid/left/Label.text = precision % left $Grid/down/Label.text = precision % down $Grid/up/Label.text = precision % up $Grid/right/Label.text = precision % right $TopRow/lbl_start.text = "start\n" + precision % start $TopRow/lbl_back.text = "back\n" + precision % back $Grid/left/t.modulate = color_on if Input.is_joy_button_pressed(joypad_index, id_left) else color_off $Grid/down/t.modulate = color_on if Input.is_joy_button_pressed(joypad_index, id_down) else color_off $Grid/up/t.modulate = color_on if Input.is_joy_button_pressed(joypad_index, id_up) else color_off $Grid/right/t.modulate = color_on if Input.is_joy_button_pressed(joypad_index, id_right) else color_off $TopRow/lbl_start.uppercase = Input.is_joy_button_pressed(joypad_index, id_start) $TopRow/lbl_back.uppercase = Input.is_joy_button_pressed(joypad_index, id_back)