meat_madness_redux/godot/screens/PauseScreen.gd

40 lines
1015 B
GDScript3
Raw Normal View History

extends Control
var is_paused = false setget set_is_paused
func _ready():
visible = false
func _unhandled_input(event):
if event.is_action_pressed("pause"):
self.is_paused = !is_paused
func set_is_paused(value):
if Input.get_mouse_mode() == Input.MOUSE_MODE_CAPTURED:
Input.set_mouse_mode(Input.MOUSE_MODE_VISIBLE)
is_paused = value
get_tree().paused = is_paused
visible = is_paused
if is_paused:
$CenterContainer/VBoxContainer/ResumeButton.grab_focus()
func _on_QuitButton_pressed():
get_tree().quit()
func _on_ResumeButton_pressed():
get_tree().paused = false
visible = false
Input.set_mouse_mode(Input.MOUSE_MODE_CAPTURED)
func _on_MainMenuButton_pressed():
get_tree().paused = false
var _a = get_tree().change_scene("res://screens/TitleScreen.tscn")
func _on_ControlsButton_pressed():
var dialog = Dialogic.start("controls")
add_child(dialog)
dialog.connect("tree_exiting", self, "controls_done")
func controls_done():
$CenterContainer/VBoxContainer/ControlsButton.grab_focus()