blob: 98208452aef0c3a3d424c021954bcb3d5e2ec07e (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
|
extends CanvasLayer
onready var pause_menu = $Node2D
signal unpause()
func pause():
pause_mode = PAUSE_MODE_PROCESS # to be save
pause_menu.visible = true
get_tree().paused = true
func _on_Resume_on_click():
pause_menu.visible = false
get_tree().paused = false
emit_signal("unpause")
func _unhandled_input(event):
if event is InputEventKey and event.pressed and event.scancode == KEY_ESCAPE:
if pause_menu.visible:
_on_Resume_on_click()
else:
pause()
func _on_Main_Menu_on_click():
get_tree().paused = false
get_tree().change_scene("res://scenes/menu.tscn")
|