Adds key bindings for (re)starting and exitting
parent
2910cfb515
commit
9a97a0cc9e
|
@ -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()
|
||||
|
|
|
@ -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)
|
||||
|
||||
|
|
Loading…
Reference in New Issue