Add menu system and scene navigation

The changes include: - Moving script files to scripts/ directory -
Creating Start menu scene with Play/Quit buttons - Adding scene
switching between menu and gameplay - Creating theme for menu buttons -
Adding ESC key to return to menu
This commit is contained in:
Henry 2025-10-12 13:20:30 +01:00
parent 83ff6ef14d
commit 49988ae674
14 changed files with 202 additions and 6 deletions

55
scenes/Start.tscn Normal file
View file

@ -0,0 +1,55 @@
[gd_scene load_steps=4 format=3 uid="uid://d04c3lqwj6a5h"]
[ext_resource type="Script" uid="uid://d3rocjpvkb3te" path="res://scripts/start.gd" id="1_r305v"]
[ext_resource type="Theme" uid="uid://cga6aww0tbilq" path="res://resources/pong_theme.tres" id="3_gx2gx"]
[sub_resource type="GDScript" id="GDScript_fx3ca"]
script/source = "extends VBoxContainer
"
[node name="Start" type="Control"]
layout_mode = 3
anchors_preset = 15
anchor_right = 1.0
anchor_bottom = 1.0
grow_horizontal = 2
grow_vertical = 2
script = ExtResource("1_r305v")
[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.29000002, 0.402, 0.5, 1)
[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
theme_override_constants/separation = 175
script = SubResource("GDScript_fx3ca")
[node name="Button_Play" type="Button" parent="CenterContainer/VBoxContainer"]
unique_name_in_owner = true
layout_mode = 2
theme = ExtResource("3_gx2gx")
theme_override_colors/font_color = Color(0.87, 0.87, 0.87, 1)
theme_override_constants/outline_size = 2
text = "Play"
[node name="Button_Quit" type="Button" parent="CenterContainer/VBoxContainer"]
unique_name_in_owner = true
layout_mode = 2
theme = ExtResource("3_gx2gx")
theme_override_colors/font_color = Color(0.87, 0.87, 0.87, 1)
theme_override_constants/outline_size = 2
text = "Quit"