Adds rules to main menu

master
TechieDamien 2025-08-01 13:53:45 +01:00
parent df094f18cf
commit 90814db16e
Signed by: TechieDamien
GPG Key ID: 2ACE3574E164B780
2 changed files with 146 additions and 1 deletions

View File

@ -1,9 +1,14 @@
[gd_scene load_steps=10 format=3 uid="uid://bu5cwjawsnb1q"] [gd_scene load_steps=17 format=3 uid="uid://bu5cwjawsnb1q"]
[ext_resource type="Script" uid="uid://bomw4j2mmerry" path="res://Scripts/main_menu.gd" id="1_28flt"] [ext_resource type="Script" uid="uid://bomw4j2mmerry" path="res://Scripts/main_menu.gd" id="1_28flt"]
[ext_resource type="Texture2D" uid="uid://dxdtqv4do4x31" path="res://Sprites/background.png" id="2_48xlc"] [ext_resource type="Texture2D" uid="uid://dxdtqv4do4x31" path="res://Sprites/background.png" id="2_48xlc"]
[ext_resource type="Texture2D" uid="uid://c6kno4vjbvu28" path="res://Sprites/ouroboros.png" id="3_ce3w2"] [ext_resource type="Texture2D" uid="uid://c6kno4vjbvu28" path="res://Sprites/ouroboros.png" id="3_ce3w2"]
[ext_resource type="Script" uid="uid://dp3dc6g76g8wq" path="res://Scripts/menu_ouroboros.gd" id="4_n45e2"] [ext_resource type="Script" uid="uid://dp3dc6g76g8wq" path="res://Scripts/menu_ouroboros.gd" id="4_n45e2"]
[ext_resource type="Texture2D" uid="uid://bbutodjdye61j" path="res://Sprites/cherry.png" id="5_trj04"]
[ext_resource type="FontFile" uid="uid://cupgp2iqxdun5" path="res://Fonts/Kings-Regular.ttf" id="6_16hvj"]
[ext_resource type="Texture2D" uid="uid://dr3y3mvyrecxn" path="res://Sprites/lemon.png" id="7_vr1f0"]
[ext_resource type="Texture2D" uid="uid://csu4d06po6r6x" path="res://Sprites/apple.png" id="8_t1dhk"]
[ext_resource type="Texture2D" uid="uid://ccqroki031ou" path="res://Sprites/watermelon.png" id="9_5egv6"]
[sub_resource type="LabelSettings" id="LabelSettings_ce3w2"] [sub_resource type="LabelSettings" id="LabelSettings_ce3w2"]
font_size = 160 font_size = 160
@ -25,6 +30,15 @@ font_color = Color(0.545098, 0, 0, 1)
font_size = 160 font_size = 160
font_color = Color(1, 1, 0, 1) font_color = Color(1, 1, 0, 1)
[sub_resource type="LabelSettings" id="LabelSettings_vtepg"]
line_spacing = -1.0
paragraph_spacing = 1.0
[sub_resource type="LabelSettings" id="LabelSettings_8dnnj"]
font = ExtResource("6_16hvj")
font_size = 18
font_color = Color(0, 0, 0, 1)
[node name="MainMenu" type="Control"] [node name="MainMenu" type="Control"]
layout_mode = 3 layout_mode = 3
anchors_preset = 15 anchors_preset = 15
@ -58,7 +72,12 @@ grow_vertical = 2
layout_mode = 2 layout_mode = 2
text = "Start Game" text = "Start Game"
[node name="Help" type="Button" parent="Buttons"]
layout_mode = 2
text = "How to Play"
[node name="Options" type="Button" parent="Buttons"] [node name="Options" type="Button" parent="Buttons"]
visible = false
layout_mode = 2 layout_mode = 2
text = "Options" text = "Options"
@ -145,5 +164,118 @@ offset_bottom = 291.0
text = "s" text = "s"
label_settings = SubResource("LabelSettings_yhxw7") label_settings = SubResource("LabelSettings_yhxw7")
[node name="HelpPanel" type="Panel" parent="."]
visible = false
layout_mode = 1
anchors_preset = -1
anchor_left = 0.25
anchor_top = 0.375
anchor_right = 0.75
anchor_bottom = 0.8
grow_horizontal = 2
grow_vertical = 2
[node name="Label" type="Label" parent="HelpPanel"]
layout_mode = 1
anchors_preset = 15
anchor_right = 1.0
anchor_bottom = 1.0
grow_horizontal = 2
grow_vertical = 2
text = "A game of Ouroboros is about creating loops of snakes, called an Ouroboros. The aim is to create as many Ouroboroses as you can.
To control your snake, you can use, WASD, arrow keys or Vi direction keys.
Eating a fruit does not give you any points, but will increase the length of your snake according the type of fruit as shown below.
Each time you achieve an Ouroboros, you get one score and start as a new snake inside the old Ouroboros, making the arena smaller."
label_settings = SubResource("LabelSettings_vtepg")
autowrap_mode = 3
[node name="FruitExamples" type="HBoxContainer" parent="HelpPanel"]
layout_mode = 1
anchors_preset = -1
anchor_top = 1.0
anchor_right = 1.0
anchor_bottom = 1.0
offset_top = -107.0
offset_bottom = -60.0
grow_horizontal = 2
grow_vertical = 0
[node name="Separator4" type="Control" parent="HelpPanel/FruitExamples"]
layout_mode = 2
size_flags_horizontal = 3
[node name="TextureRect" type="TextureRect" parent="HelpPanel/FruitExamples"]
layout_mode = 2
texture = ExtResource("5_trj04")
stretch_mode = 2
[node name="Label" type="Label" parent="HelpPanel/FruitExamples"]
layout_mode = 2
text = "=1"
label_settings = SubResource("LabelSettings_8dnnj")
[node name="Separator" type="Control" parent="HelpPanel/FruitExamples"]
layout_mode = 2
size_flags_horizontal = 3
[node name="TextureRect2" type="TextureRect" parent="HelpPanel/FruitExamples"]
layout_mode = 2
texture = ExtResource("7_vr1f0")
stretch_mode = 2
[node name="Label2" type="Label" parent="HelpPanel/FruitExamples"]
layout_mode = 2
text = "=3"
label_settings = SubResource("LabelSettings_8dnnj")
[node name="Separator2" type="Control" parent="HelpPanel/FruitExamples"]
layout_mode = 2
size_flags_horizontal = 3
[node name="TextureRect3" type="TextureRect" parent="HelpPanel/FruitExamples"]
layout_mode = 2
texture = ExtResource("8_t1dhk")
stretch_mode = 2
[node name="Label3" type="Label" parent="HelpPanel/FruitExamples"]
layout_mode = 2
text = "=5"
label_settings = SubResource("LabelSettings_8dnnj")
[node name="Separator3" type="Control" parent="HelpPanel/FruitExamples"]
layout_mode = 2
size_flags_horizontal = 3
[node name="TextureRect4" type="TextureRect" parent="HelpPanel/FruitExamples"]
layout_mode = 2
texture = ExtResource("9_5egv6")
stretch_mode = 2
[node name="Label4" type="Label" parent="HelpPanel/FruitExamples"]
layout_mode = 2
text = "=10"
label_settings = SubResource("LabelSettings_8dnnj")
[node name="Separator5" type="Control" parent="HelpPanel/FruitExamples"]
layout_mode = 2
size_flags_horizontal = 3
[node name="Button" type="Button" parent="HelpPanel"]
layout_mode = 1
anchors_preset = -1
anchor_top = 1.0
anchor_right = 1.0
anchor_bottom = 1.0
offset_bottom = 27.0
grow_horizontal = 2
grow_vertical = 0
text = "OK"
[connection signal="pressed" from="Buttons/Start" to="." method="start_game"] [connection signal="pressed" from="Buttons/Start" to="." method="start_game"]
[connection signal="pressed" from="Buttons/Help" to="." method="show_help"]
[connection signal="pressed" from="Buttons/Quit" to="." method="quit"] [connection signal="pressed" from="Buttons/Quit" to="." method="quit"]
[connection signal="pressed" from="HelpPanel/Button" to="." method="hide_help"]

View File

@ -2,8 +2,21 @@ extends Control
var main_scene : PackedScene = preload("res://Scenes/main.tscn") var main_scene : PackedScene = preload("res://Scenes/main.tscn")
@onready
var help_panel : Panel = $HelpPanel
func _ready() -> void:
if OS.has_feature("web"):
$Buttons/Quit.visible = false
func start_game() -> void: func start_game() -> void:
get_tree().change_scene_to_packed(main_scene) get_tree().change_scene_to_packed(main_scene)
func quit() -> void: func quit() -> void:
get_tree().quit(0) get_tree().quit(0)
func show_help() -> void:
help_panel.visible = true
func hide_help() -> void:
help_panel.visible = false