Adds key bindings for (re)starting and exitting

master
TechieDamien 2025-08-02 14:50:37 +01:00
parent 2910cfb515
commit 9a97a0cc9e
Signed by: TechieDamien
GPG Key ID: 2ACE3574E164B780
2 changed files with 14 additions and 0 deletions

View File

@ -18,3 +18,10 @@ func back():
get_tree().change_scene_to_packed(main_menu)
GridManager.current_allowed_spawns.clear()
GameManager.score = 0
func _unhandled_input(event: InputEvent) -> void:
if event is InputEventKey:
if event.is_action_pressed("ui_accept"):
restart()
if event.is_action_pressed("ui_cancel"):
back()

View File

@ -14,6 +14,13 @@ func _ready() -> void:
$Buttons/Quit.visible = false
$Buttons/SourceCode.text = "Source Code (Opens in another tab)"
func _unhandled_input(event: InputEvent) -> void:
if event is InputEventKey:
if event.is_action_pressed("ui_accept"):
start_game()
if event.is_action_pressed("ui_cancel") and !OS.has_feature("web"):
quit()
func start_game() -> void:
get_tree().change_scene_to_packed(main_scene)