new ring counter, move some logic away from main scene
This commit is contained in:
parent
b81eb08e05
commit
9890e0a625
5 changed files with 187 additions and 143 deletions
78
menus/pause_menu.tscn
Normal file
78
menus/pause_menu.tscn
Normal file
|
@ -0,0 +1,78 @@
|
|||
[gd_scene load_steps=2 format=3 uid="uid://dkxtwpcy4moyo"]
|
||||
|
||||
[sub_resource type="GDScript" id="GDScript_d8v8v"]
|
||||
script/source = "extends Control
|
||||
|
||||
signal request_pause
|
||||
signal request_fullscreen
|
||||
signal request_restart
|
||||
|
||||
func _ready() -> void:
|
||||
var os_name = OS.get_name()
|
||||
if os_name == \"Web\": ## you can't quit the game on web (you're stuck here forever :))
|
||||
$VBoxContainer/Btn_Quit.hide()
|
||||
|
||||
func _input(_event: InputEvent) -> void:
|
||||
if Input.is_action_just_pressed(\"pause_game\"):
|
||||
request_pause.emit(!self.visible)
|
||||
|
||||
func _on_btn_resume_pressed() -> void:
|
||||
request_pause.emit(false)
|
||||
|
||||
func _on_btn_fullscreen_pressed() -> void:
|
||||
request_fullscreen.emit()
|
||||
|
||||
func _on_btn_restart_pressed() -> void:
|
||||
request_restart.emit()
|
||||
|
||||
func _on_btn_quit_pressed() -> void:
|
||||
get_tree().quit()
|
||||
"
|
||||
|
||||
[node name="PauseMenu" type="Control"]
|
||||
z_index = 2
|
||||
layout_mode = 3
|
||||
anchors_preset = 15
|
||||
anchor_right = 1.0
|
||||
anchor_bottom = 1.0
|
||||
grow_horizontal = 2
|
||||
grow_vertical = 2
|
||||
mouse_filter = 1
|
||||
script = SubResource("GDScript_d8v8v")
|
||||
|
||||
[node name="VBoxContainer" type="VBoxContainer" parent="."]
|
||||
layout_mode = 1
|
||||
anchors_preset = 14
|
||||
anchor_top = 0.5
|
||||
anchor_right = 1.0
|
||||
anchor_bottom = 0.5
|
||||
offset_top = -50.5
|
||||
offset_bottom = 50.5
|
||||
grow_horizontal = 2
|
||||
grow_vertical = 2
|
||||
theme_override_constants/separation = 10
|
||||
|
||||
[node name="Btn_Resume" type="Button" parent="VBoxContainer"]
|
||||
layout_mode = 2
|
||||
size_flags_vertical = 6
|
||||
text = "RESUME game"
|
||||
|
||||
[node name="Btn_Fullscreen" type="Button" parent="VBoxContainer"]
|
||||
layout_mode = 2
|
||||
size_flags_vertical = 6
|
||||
text = "Toggle FULLSCREEN"
|
||||
|
||||
[node name="Btn_Restart" type="Button" parent="VBoxContainer"]
|
||||
layout_mode = 2
|
||||
size_flags_vertical = 6
|
||||
text = "RESTART the level"
|
||||
|
||||
[node name="Btn_Quit" type="Button" parent="VBoxContainer"]
|
||||
layout_mode = 2
|
||||
size_flags_vertical = 6
|
||||
text = "QUIT game"
|
||||
|
||||
[connection signal="pressed" from="VBoxContainer/Btn_Resume" to="." method="_on_btn_resume_pressed"]
|
||||
[connection signal="pressed" from="VBoxContainer/Btn_Fullscreen" to="." method="_on_btn_fullscreen_pressed"]
|
||||
[connection signal="pressed" from="VBoxContainer/Btn_Restart" to="." method="_on_btn_restart_pressed"]
|
||||
[connection signal="pressed" from="VBoxContainer/Btn_Quit" to="." method="_on_btn_quit_pressed"]
|
Loading…
Add table
Add a link
Reference in a new issue