feat: added main menu and game over
This commit is contained in:
		
							parent
							
								
									c57a4c8bb9
								
							
						
					
					
						commit
						5b826cc23b
					
				
							
								
								
									
										36
									
								
								project/menus/main_menu.tscn
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										36
									
								
								project/menus/main_menu.tscn
									
									
									
									
									
										Normal 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"]
 | 
			
		||||
| 
						 | 
				
			
			@ -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"]
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -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"
 | 
			
		||||
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
		Loading…
	
		Reference in a new issue