57 lines
1.4 KiB
Plaintext
57 lines
1.4 KiB
Plaintext
[gd_scene load_steps=2 format=3 uid="uid://bt054d3ic71rf"]
|
|
|
|
[sub_resource type="GDScript" id="GDScript_7ng1a"]
|
|
script/source = "extends CenterContainer
|
|
|
|
var is_open := false
|
|
|
|
func toggle_open():
|
|
set_open(!is_open)
|
|
|
|
func set_open(val: bool):
|
|
is_open = val
|
|
visible = is_open
|
|
get_tree().paused = is_open
|
|
if is_open:
|
|
Input.mouse_mode = Input.MOUSE_MODE_VISIBLE
|
|
mouse_filter = Control.MOUSE_FILTER_IGNORE
|
|
else:
|
|
Input.mouse_mode = Input.MOUSE_MODE_CAPTURED
|
|
mouse_filter = Control.MOUSE_FILTER_PASS
|
|
|
|
func _enter_tree():
|
|
set_open(false)
|
|
|
|
func _unhandled_input(event: InputEvent) -> void:
|
|
if event.is_action_pressed(\"open_menu\"):
|
|
set_open(!is_open)
|
|
|
|
|
|
func _on_main_menu_pressed() -> void:
|
|
get_tree().paused = false
|
|
get_tree().change_scene_to_file.call_deferred(\"res://menus/main_menu.tscn\")
|
|
"
|
|
|
|
[node name="PauseMenu" type="CenterContainer"]
|
|
process_mode = 3
|
|
anchors_preset = 15
|
|
anchor_right = 1.0
|
|
anchor_bottom = 1.0
|
|
grow_horizontal = 2
|
|
grow_vertical = 2
|
|
script = SubResource("GDScript_7ng1a")
|
|
|
|
[node name="VBoxContainer" type="VBoxContainer" parent="."]
|
|
layout_mode = 2
|
|
|
|
[node name="Resume" type="Button" parent="VBoxContainer"]
|
|
layout_mode = 2
|
|
text = "Resume"
|
|
|
|
[node name="Main Menu" type="Button" parent="VBoxContainer"]
|
|
layout_mode = 2
|
|
text = "Main Menu"
|
|
|
|
[connection signal="pressed" from="VBoxContainer/Resume" to="." method="toggle_open"]
|
|
[connection signal="pressed" from="VBoxContainer/Main Menu" to="." method="_on_main_menu_pressed"]
|