pause_menu.gd 597 B

12345678910111213141516171819202122
  1. extends Control
  2. @onready var root = get_tree().get_root().get_child(0)
  3. var queue_unpause = false
  4. func _input(input: InputEvent):
  5. if input.is_action_pressed("pause") or input.is_action_pressed("rmb"):
  6. queue_unpause = true
  7. func _process(_delta: float):
  8. if queue_unpause:
  9. unpause()
  10. queue_unpause = false
  11. func unpause():
  12. if root.main_menu_beaten:
  13. get_tree().paused = false
  14. hide()
  15. func _on_visibility_changed():
  16. if Input.get_connected_joypads().size() > 0:
  17. $"CenterContainer/Buttons/WindowMode/CenterContainer/OptionButton".grab_focus()