-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathCanvasLayer.gd
48 lines (38 loc) · 1.04 KB
/
CanvasLayer.gd
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
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
extends Control
@onready var pause_menu = $"."
@onready var options = $Options
func _ready():
$AnimationPlayer.play("RESET")
print("Pause menu ready.")
func _input(event: InputEvent) -> void:
if Input.is_action_just_pressed("esc"):
if get_tree().paused:
resume()
else:
pause()
func pause():
print("Pause menu activated.")
get_tree().paused = true
$AnimationPlayer.play("blur")
pause_menu.visible = true
Input.set_mouse_mode(Input.MOUSE_MODE_VISIBLE)
func resume():
print("Pause menu deactivated.")
get_tree().paused = false
$AnimationPlayer.play_backwards("blur")
pause_menu.visible = false
Input.set_mouse_mode(Input.MOUSE_MODE_CAPTURED)
func _on_resume_pressed():
print("Resume button pressed.")
resume()
func _on_quit_pressed():
print("Quit button pressed.")
get_tree().quit()
func _on_options_pressed():
options.visible = true
func _on_restart_pressed():
print("Restart button pressed.")
get_tree().paused = false
get_tree().change_scene_to_file("res://world.tscn")
func _on_options_hide_options():
options.visible = false