Router.gd 438 B

123456789101112131415161718192021
  1. extends Node
  2. const MENU_FILE: String = "res://run/menu.tscn"
  3. func _input(event: InputEvent) -> void:
  4. if event.is_action_pressed("ui_cancel"):
  5. go_back_to_menu()
  6. if event.is_action_pressed("ui_accept"):
  7. toggle_pause()
  8. func go_back_to_menu():
  9. get_tree().set_pause(false)
  10. get_tree().change_scene_to_file(MENU_FILE)
  11. func toggle_pause():
  12. var current_status: bool = get_tree().is_paused()
  13. get_tree().set_pause(!current_status)