pause_menu.gd 954 B

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748
  1. extends Control
  2. const curseur_main: Texture = preload("res://composants/interface/curseur/hand_point.png")
  3. func _ready() -> void:
  4. Input.set_custom_mouse_cursor(curseur_main, Input.CURSOR_POINTING_HAND)
  5. func reprendre() -> void:
  6. hide()
  7. AudioServer.set_bus_effect_enabled(2, 1,false)
  8. get_tree().set_pause(false)
  9. Input.set_custom_mouse_cursor(null, Input.CURSOR_ARROW)
  10. func _unhandled_input(event: InputEvent) -> void:
  11. if event.is_action_released("ui_pause"):
  12. if get_tree().is_paused():
  13. reprendre()
  14. else:
  15. AudioServer.set_bus_effect_enabled(2, 1, true)
  16. get_tree().set_pause(true)
  17. show()
  18. func _quand_bouton_reprendre_est_presse():
  19. reprendre()
  20. func _quand_bouton_retour_titre_est_presse():
  21. reprendre()
  22. get_tree().reload_current_scene()
  23. func _quand_bouton_quitter_est_presse():
  24. get_tree().quit()
  25. func _on_visibility_changed():
  26. if visible:
  27. _activer_pause()
  28. func _activer_pause() -> void:
  29. %Reprendre.grab_focus()