Added game over screen

This commit is contained in:
2026-06-29 21:28:55 +03:00
parent dae6853e4f
commit 4bccabb7ee
18 changed files with 260 additions and 6 deletions
+37
View File
@@ -0,0 +1,37 @@
class_name GameOverMenu
extends Control
@onready var retry_button : Button = $%RetryButton
@onready var main_menu_button : Button = $%MainMenuButton
@onready var focus_timer : Timer = $FocusTimer
func _on_gui_focus_changed(_node: Control) -> void:
SoundManager.play_ui_stream(SoundManager.ui_stream_select)
func _on_retry_button_pressed() -> void:
SoundManager.play_ui_stream(SoundManager.ui_stream_accept)
get_tree().paused = false
get_tree().change_scene_to_file(get_tree().current_scene.scene_file_path)
func _on_main_menu_button_pressed() -> void:
SoundManager.play_ui_stream(SoundManager.ui_stream_accept)
get_tree().paused = false
get_tree().change_scene_to_file("res://game/menu/main_menu.tscn")
func _on_visibility_changed() -> void:
if not is_node_ready(): return
if visible:
focus_timer.start()
get_viewport().gui_focus_changed.connect(_on_gui_focus_changed)
elif get_viewport().gui_focus_changed.is_connected(_on_gui_focus_changed):
get_viewport().gui_focus_changed.disconnect(_on_gui_focus_changed)
func _on_focus_timer_timeout() -> void:
if main_menu_button != null:
retry_button.grab_focus()
+1
View File
@@ -0,0 +1 @@
uid://coqb1xl7lngo5
+58
View File
@@ -0,0 +1,58 @@
[gd_scene format=3 uid="uid://cl7vqh8j2f5py"]
[ext_resource type="Theme" uid="uid://bqj884yfvhhft" path="res://game/themes/main_menu.tres" id="1_htxfh"]
[ext_resource type="Script" uid="uid://coqb1xl7lngo5" path="res://game/menu/game_over_menu.gd" id="2_m1ad0"]
[node name="GameOverMenu" type="Control" unique_id=795145041]
layout_mode = 3
anchors_preset = 15
anchor_right = 1.0
anchor_bottom = 1.0
grow_horizontal = 2
grow_vertical = 2
theme = ExtResource("1_htxfh")
script = ExtResource("2_m1ad0")
[node name="ColorRect" type="ColorRect" parent="." unique_id=851679792]
layout_mode = 1
anchors_preset = 15
anchor_right = 1.0
anchor_bottom = 1.0
grow_horizontal = 2
grow_vertical = 2
color = Color(0.19607843, 0.19215687, 0.23137255, 1)
[node name="MarginContainer" type="MarginContainer" parent="." unique_id=1675617760]
layout_mode = 1
anchors_preset = 15
anchor_right = 1.0
anchor_bottom = 1.0
grow_horizontal = 2
grow_vertical = 2
[node name="VBoxContainer" type="VBoxContainer" parent="MarginContainer" unique_id=1046629699]
layout_mode = 2
alignment = 1
[node name="Label" type="Label" parent="MarginContainer/VBoxContainer" unique_id=641992920]
layout_mode = 2
text = "GAME OVER"
horizontal_alignment = 1
[node name="RetryButton" type="Button" parent="MarginContainer/VBoxContainer" unique_id=538467341]
unique_name_in_owner = true
layout_mode = 2
text = "RETRY"
[node name="MainMenuButton" type="Button" parent="MarginContainer/VBoxContainer" unique_id=1995734325]
unique_name_in_owner = true
layout_mode = 2
text = "MAIN MENU"
[node name="FocusTimer" type="Timer" parent="." unique_id=1727491464]
one_shot = true
[connection signal="visibility_changed" from="." to="." method="_on_visibility_changed"]
[connection signal="pressed" from="MarginContainer/VBoxContainer/RetryButton" to="." method="_on_retry_button_pressed"]
[connection signal="pressed" from="MarginContainer/VBoxContainer/MainMenuButton" to="." method="_on_main_menu_button_pressed"]
[connection signal="timeout" from="FocusTimer" to="." method="_on_focus_timer_timeout"]
+9 -1
View File
@@ -14,6 +14,15 @@ grow_vertical = 2
theme = ExtResource("1_5d27k")
script = ExtResource("2_qnvmd")
[node name="ColorRect" type="ColorRect" parent="." unique_id=669952833]
layout_mode = 1
anchors_preset = 15
anchor_right = 1.0
anchor_bottom = 1.0
grow_horizontal = 2
grow_vertical = 2
color = Color(0.19607843, 0.19215687, 0.23137255, 1)
[node name="MarginContainer" type="MarginContainer" parent="." unique_id=1180781679]
layout_mode = 1
anchors_preset = 15
@@ -24,7 +33,6 @@ grow_vertical = 2
[node name="VBoxContainer" type="VBoxContainer" parent="MarginContainer" unique_id=736037128]
layout_mode = 2
size_flags_horizontal = 4
alignment = 1
[node name="StartButton" type="Button" parent="MarginContainer/VBoxContainer" unique_id=1504018605]
+10
View File
@@ -19,6 +19,15 @@ grow_vertical = 2
theme = ExtResource("1_e2bp2")
script = ExtResource("1_lq2ks")
[node name="ColorRect" type="ColorRect" parent="." unique_id=1883678162]
layout_mode = 1
anchors_preset = 15
anchor_right = 1.0
anchor_bottom = 1.0
grow_horizontal = 2
grow_vertical = 2
color = Color(0.19607843, 0.19215687, 0.23137255, 1)
[node name="MarginContainer" type="MarginContainer" parent="." unique_id=2127037660]
layout_mode = 1
anchors_preset = 15
@@ -138,6 +147,7 @@ alignment = 1
[node name="BackButton" type="Button" parent="MarginContainer/VBoxContainer/HBoxContainer" unique_id=131108983]
unique_name_in_owner = true
layout_mode = 2
size_flags_horizontal = 3
shortcut = SubResource("Shortcut_e2bp2")
text = "BACK"
+9
View File
@@ -13,6 +13,15 @@ grow_vertical = 2
theme = ExtResource("1_i4rg2")
script = ExtResource("2_e1jsn")
[node name="ColorRect" type="ColorRect" parent="." unique_id=1984802285]
layout_mode = 1
anchors_preset = 15
anchor_right = 1.0
anchor_bottom = 1.0
grow_horizontal = 2
grow_vertical = 2
color = Color(0.19607843, 0.19215687, 0.23137255, 1)
[node name="MarginContainer" type="MarginContainer" parent="." unique_id=2013458760]
layout_mode = 1
anchors_preset = 15