feat: added main menu and game over

This commit is contained in:
Sara 2025-07-23 14:42:49 +02:00
parent c57a4c8bb9
commit 5b826cc23b
3 changed files with 42 additions and 1 deletions

View file

@ -0,0 +1,36 @@
[gd_scene load_steps=2 format=3 uid="uid://dti7d1rslmhgp"]
[sub_resource type="GDScript" id="GDScript_kvqlu"]
script/source = "extends Control
@onready var next_scene := preload(\"res://maps/testmap.tscn\")
func _on_start_button_pressed() -> void:
get_tree().change_scene_to_packed(next_scene)
"
[node name="MainMenu" type="Control"]
layout_mode = 3
anchors_preset = 15
anchor_right = 1.0
anchor_bottom = 1.0
grow_horizontal = 2
grow_vertical = 2
script = SubResource("GDScript_kvqlu")
[node name="CenterContainer" type="CenterContainer" 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="CenterContainer"]
layout_mode = 2
[node name="StartButton" type="Button" parent="CenterContainer/VBoxContainer"]
layout_mode = 2
text = "Start"
[connection signal="pressed" from="CenterContainer/VBoxContainer/StartButton" to="." method="_on_start_button_pressed"]

View file

@ -7,6 +7,10 @@ script/source = "extends HealthStatus
func _on_health_changed(remaining: int, delta: int) -> void:
print(\"Player Health Changed:\", delta, \"remaining:\", remaining)
func _on_death() -> void:
get_tree().change_scene_to_file(\"res://menus/main_menu.tscn\")
"
[sub_resource type="CapsuleShape3D" id="CapsuleShape3D_bxedw"]
@ -46,4 +50,5 @@ health = NodePath("../HealthStatus")
transform = Transform3D(1, 0, 0, 0, 1, 0, 0, 0, 1, 0, 1, 0)
shape = SubResource("CapsuleShape3D_eqqp1")
[connection signal="death" from="HealthStatus" to="HealthStatus" method="_on_death"]
[connection signal="health_changed" from="HealthStatus" to="HealthStatus" method="_on_health_changed"]

View file

@ -11,7 +11,7 @@ config_version=5
[application]
config/name="wave_survival"
run/main_scene="uid://dukbdx7dt2qut"
run/main_scene="uid://dti7d1rslmhgp"
config/features=PackedStringArray("4.5", "Forward Plus")
config/icon="res://icon.svg"