pause_menu.gd 509 B

1234567891011121314151617181920212223242526272829303132
  1. extends VSplitContainer
  2. func resume() -> void:
  3. hide()
  4. get_tree().set_pause(false)
  5. func _unhandled_input(event: InputEvent) -> void:
  6. if event.is_action_released("ui_pause"):
  7. if get_tree().is_paused():
  8. resume()
  9. else:
  10. get_tree().set_pause(true)
  11. show()
  12. func _on_resume_button_pressed():
  13. resume()
  14. func _on_title_button_pressed():
  15. get_tree().reload_current_scene()
  16. resume()
  17. func _on_quit_button_pressed():
  18. get_tree().quit()
  19. func _on_visibility_changed():
  20. %ResumeButton.grab_focus()