pir-serious-game-ethics/scenes/PauseMenu.gd

40 lines
663 B
GDScript3
Raw Normal View History

2021-04-09 11:19:10 +02:00
extends Control
2021-04-10 18:29:03 +02:00
func load_main_menu():
2021-04-25 00:07:38 +02:00
Transit.change_scene("res://scenes/MainMenu.tscn", 0.5)
2021-04-10 18:29:03 +02:00
2021-04-09 11:19:10 +02:00
func pause():
get_tree().paused = true
show()
func unpause():
get_tree().paused = false
hide()
func _ready():
connect("gui_input", self, '_on_gui_input')
func _input(event: InputEvent):
if event.is_action_pressed("ui_cancel") and visible:
unpause()
get_tree().set_input_as_handled()
2021-04-09 11:33:19 +02:00
elif event.is_action_pressed("ui_cancel") and not visible:
pause()
get_tree().set_input_as_handled()
2021-04-09 11:19:10 +02:00
func _on_BackgroundButton_pressed():
unpause()
func _on_ContinueButton_pressed():
unpause()
2021-04-10 18:29:03 +02:00
func _on_MenuButton_pressed():
unpause()
load_main_menu()