diff --git a/Scenes/main_menu.tscn b/Scenes/main_menu.tscn new file mode 100644 index 0000000..3101117 --- /dev/null +++ b/Scenes/main_menu.tscn @@ -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"] diff --git a/Scripts/main_menu.gd b/Scripts/main_menu.gd new file mode 100644 index 0000000..83f202e --- /dev/null +++ b/Scripts/main_menu.gd @@ -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) diff --git a/Scripts/main_menu.gd.uid b/Scripts/main_menu.gd.uid new file mode 100644 index 0000000..4fabd6d --- /dev/null +++ b/Scripts/main_menu.gd.uid @@ -0,0 +1 @@ +uid://bomw4j2mmerry diff --git a/Scripts/score_display.gd b/Scripts/score_display.gd index 37ef7cd..de1ffe4 100644 --- a/Scripts/score_display.gd +++ b/Scripts/score_display.gd @@ -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") diff --git a/project.godot b/project.godot index dbf7f45..b8b2ec3 100644 --- a/project.godot +++ b/project.godot @@ -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"