PauseGameMenu.gd 927 B

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950
  1. extends Control
  2. var is_paused = false
  3. func _ready():
  4. set_process(true)
  5. func update_pause_status():
  6. get_tree().paused = is_paused
  7. visible = is_paused
  8. if is_paused == true:
  9. Input.set_mouse_mode(Input.MOUSE_MODE_VISIBLE)
  10. else:
  11. Input.set_mouse_mode(Input.MOUSE_MODE_HIDDEN)
  12. func _process(delta):
  13. #print ("running")
  14. if Input.is_action_just_pressed("ui_cancel"):
  15. #print ("pause!")
  16. is_paused = !is_paused
  17. update_pause_status()
  18. func _on_ResumeGameButton_pressed():
  19. is_paused = false
  20. update_pause_status()
  21. func _on_RestartGameButton_pressed():
  22. is_paused = false
  23. update_pause_status()
  24. get_tree().reload_current_scene()
  25. func _on_ExitGameButton_pressed():
  26. is_paused = false
  27. update_pause_status()
  28. get_tree().change_scene("res://UI/LevelSelectionScreen.tscn")
  29. Input.set_mouse_mode(Input.MOUSE_MODE_VISIBLE)
  30. #get_node("/root/global").changeToCustomScene("res://MainMenu.tscn")