Adds main menu

master
TechieDamien 2025-07-31 15:43:44 +01:00
parent f1054637ed
commit b32eee2d6c
Signed by: TechieDamien
GPG Key ID: 2ACE3574E164B780
5 changed files with 70 additions and 1 deletions

58
Scenes/main_menu.tscn Normal file
View File

@ -0,0 +1,58 @@
[gd_scene load_steps=3 format=3 uid="uid://bu5cwjawsnb1q"]
[ext_resource type="Script" uid="uid://bomw4j2mmerry" path="res://Scripts/main_menu.gd" id="1_28flt"]
[sub_resource type="PlaceholderTexture2D" id="PlaceholderTexture2D_erv1k"]
size = Vector2(800, 160)
[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 = ExtResource("1_28flt")
[node name="Container" type="Control" parent="."]
layout_mode = 1
anchors_preset = 0
offset_right = 40.0
offset_bottom = 40.0
[node name="Buttons" type="VBoxContainer" parent="."]
layout_mode = 1
anchors_preset = -1
anchor_left = 0.3
anchor_top = 0.432
anchor_right = 0.7
anchor_bottom = 0.909
grow_horizontal = 2
grow_vertical = 2
[node name="Start" type="Button" parent="Buttons"]
layout_mode = 2
text = "Start Game"
[node name="Options" type="Button" parent="Buttons"]
layout_mode = 2
text = "Options"
[node name="Quit" type="Button" parent="Buttons"]
layout_mode = 2
text = "Quit"
[node name="TextureRect" type="TextureRect" parent="."]
layout_mode = 1
anchors_preset = -1
anchor_left = 0.1
anchor_top = 0.045
anchor_right = 0.9
anchor_bottom = 0.284
grow_horizontal = 2
grow_vertical = 2
texture = SubResource("PlaceholderTexture2D_erv1k")
expand_mode = 2
[connection signal="pressed" from="Buttons/Start" to="." method="start_game"]
[connection signal="pressed" from="Buttons/Quit" to="." method="quit"]

9
Scripts/main_menu.gd Normal file
View File

@ -0,0 +1,9 @@
extends Control
var main_scene : PackedScene = preload("res://Scenes/main.tscn")
func start_game() -> void:
get_tree().change_scene_to_packed(main_scene)
func quit() -> void:
get_tree().quit(0)

1
Scripts/main_menu.gd.uid Normal file
View File

@ -0,0 +1 @@
uid://bomw4j2mmerry

View File

@ -11,7 +11,7 @@ var ouroboros_label : Label = $OuroborosPossibleLabel
var ouroboros_possible : bool = false
func _process(delta: float) -> void:
func _process(_delta: float) -> void:
score_label.text = "Score\n{score}".format(GameManager)
length_label.text = "Length\n{0}".format([get_snake_length()])
var head : Node = get_tree().get_first_node_in_group("Head")

View File

@ -11,6 +11,7 @@ config_version=5
[application]
config/name="Ouroboros"
run/main_scene="uid://bu5cwjawsnb1q"
config/features=PackedStringArray("4.4", "GL Compatibility")
config/icon="res://icon.svg"