Texpand/scenes/Main/control.gd
2024-08-20 14:50:39 +02:00

41 lines
932 B
GDScript

extends Control
@onready var buttonContainer1 = $HBoxContainer3
@onready var buttonContainer2 = $HBoxContainer4
@onready var buttonContainer3 = $HBoxContainer5
func toggleButton():
if DisplayServer.is_touchscreen_available():
buttonContainer1.show()
buttonContainer2.show()
buttonContainer3.show()
func _on_left_button_pressed() -> void:
Input.action_press("left")
Input.action_release("left")
func _on_right_button_pressed() -> void:
Input.action_press("right")
Input.action_release("right")
func _on_rotate_left_button_pressed() -> void:
Input.action_press("rotate_left")
Input.action_release("rotate_left")
func _on_rotate_right_button_pressed() -> void:
Input.action_press("rotate_right")
Input.action_release("rotate_right")
func _on_down_button_button_down() -> void:
Input.action_press("down")
func _on_down_button_button_up() -> void:
Input.action_press("down")
Input.action_release("down")