Added level completion screen

This commit is contained in:
2026-01-08 18:30:48 +03:00
parent 3e73fe8e1f
commit 3b5a60cd9b
8 changed files with 120 additions and 4 deletions
+29
View File
@@ -0,0 +1,29 @@
class_name CompletionMenu
extends Control
@export var next_level : PackedScene
@onready var next_level_button : Button = $%NextLevelButton
@onready var focus_timer : Timer = $FocusTimer
func _on_next_level_button_pressed() -> void:
get_tree().paused = false
if next_level != null:
get_tree().change_scene_to_packed(next_level)
else:
get_tree().change_scene_to_file("res://game/menu/main_menu.tscn")
func _on_visibility_changed() -> void:
if visible:
if focus_timer != null:
focus_timer.start()
func _on_focus_timer_timeout() -> void:
if next_level_button != null:
next_level_button.grab_focus()
+1
View File
@@ -0,0 +1 @@
uid://dj6porbpmqbd1
+56
View File
@@ -0,0 +1,56 @@
[gd_scene load_steps=4 format=3 uid="uid://bareycqj42c6e"]
[ext_resource type="Theme" uid="uid://bh56my8b2htnr" path="res://themes/menu.tres" id="1_0iv8v"]
[ext_resource type="Theme" uid="uid://dosa0gsbrbnpe" path="res://themes/splash.tres" id="2_0iv8v"]
[ext_resource type="Script" uid="uid://dj6porbpmqbd1" path="res://game/menu/completion_menu.gd" id="2_kge0e"]
[node name="CompletionMenu" type="Control"]
process_mode = 2
layout_mode = 3
anchors_preset = 15
anchor_right = 1.0
anchor_bottom = 1.0
grow_horizontal = 2
grow_vertical = 2
theme = ExtResource("1_0iv8v")
script = ExtResource("2_kge0e")
[node name="ColorRect" type="ColorRect" parent="."]
layout_mode = 1
anchors_preset = 15
anchor_right = 1.0
anchor_bottom = 1.0
grow_horizontal = 2
grow_vertical = 2
color = Color(0, 0, 0, 1)
[node name="MarginContainer" type="MarginContainer" parent="."]
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"]
layout_mode = 2
size_flags_horizontal = 4
size_flags_vertical = 4
theme = ExtResource("2_0iv8v")
[node name="Label" type="Label" parent="MarginContainer/VBoxContainer"]
layout_mode = 2
text = "Completed!"
horizontal_alignment = 1
[node name="NextLevelButton" type="Button" parent="MarginContainer/VBoxContainer"]
unique_name_in_owner = true
layout_mode = 2
text = "Next level"
[node name="FocusTimer" type="Timer" parent="."]
one_shot = true
[connection signal="visibility_changed" from="." to="." method="_on_visibility_changed"]
[connection signal="pressed" from="MarginContainer/VBoxContainer/NextLevelButton" to="." method="_on_next_level_button_pressed"]
[connection signal="timeout" from="FocusTimer" to="." method="_on_focus_timer_timeout"]
+4 -3
View File
@@ -1,7 +1,8 @@
[gd_scene load_steps=3 format=3 uid="uid://84lhc3yn8vub"]
[gd_scene load_steps=4 format=3 uid="uid://84lhc3yn8vub"]
[ext_resource type="Theme" uid="uid://bh56my8b2htnr" path="res://themes/menu.tres" id="1_htxfh"]
[ext_resource type="Script" uid="uid://bb257l7unttky" path="res://game/menu/game_over_menu.gd" id="2_m1ad0"]
[ext_resource type="Theme" uid="uid://dosa0gsbrbnpe" path="res://themes/splash.tres" id="3_kodbj"]
[node name="GameOverMenu" type="Control"]
process_mode = 2
@@ -35,11 +36,11 @@ grow_vertical = 2
layout_mode = 2
size_flags_horizontal = 4
size_flags_vertical = 4
theme_override_constants/separation = 64
theme = ExtResource("3_kodbj")
[node name="Label" type="Label" parent="MarginContainer/VBoxContainer"]
layout_mode = 2
text = "Game over"
text = "Game over!"
horizontal_alignment = 1
[node name="MainMenuButton" type="Button" parent="MarginContainer/VBoxContainer"]