Added pause and unpause signals
This commit is contained in:
@ -1,26 +1,37 @@
|
||||
extends Control
|
||||
|
||||
signal paused
|
||||
signal unpaused
|
||||
|
||||
func _on_game_pause_button():
|
||||
func _ready():
|
||||
Input.mouse_mode = Input.MOUSE_MODE_CAPTURED
|
||||
|
||||
func _input(event):
|
||||
if event.is_action_pressed("quit"):
|
||||
pause_game_button()
|
||||
|
||||
|
||||
func pause_game_button():
|
||||
if $Settings.visible:
|
||||
$Settings.hide()
|
||||
$"Pause Menu".show()
|
||||
elif $"Pause Menu".visible:
|
||||
$"Pause Menu".hide()
|
||||
hide()
|
||||
Input.mouse_mode = Input.MOUSE_MODE_CAPTURED
|
||||
emit_signal("unpaused")
|
||||
else:
|
||||
show()
|
||||
$"Pause Menu".show()
|
||||
Input.mouse_mode = Input.MOUSE_MODE_VISIBLE
|
||||
|
||||
|
||||
emit_signal("paused")
|
||||
|
||||
func _on_quit_pressed():
|
||||
get_tree().quit()
|
||||
|
||||
|
||||
func _on_resume_pressed():
|
||||
hide()
|
||||
Input.mouse_mode = Input.MOUSE_MODE_CAPTURED
|
||||
pause_game_button()
|
||||
|
||||
|
||||
func _on_settings_pressed():
|
||||
|
||||
Reference in New Issue
Block a user