Adds graphics for background and menu

master
TechieDamien 2025-08-01 11:48:34 +01:00
parent 5bb80495d1
commit fb766bba52
Signed by: TechieDamien
GPG Key ID: 2ACE3574E164B780
21 changed files with 243 additions and 29 deletions

View File

@ -17,6 +17,7 @@ script = ExtResource("1_arass")
[node name="FinalScore" type="Label" parent="."] [node name="FinalScore" type="Label" parent="."]
layout_mode = 2 layout_mode = 2
text = "Final Score text = "Final Score
0" 0"
label_settings = SubResource("LabelSettings_7upku") label_settings = SubResource("LabelSettings_7upku")
horizontal_alignment = 1 horizontal_alignment = 1

View File

@ -24,5 +24,6 @@ monitorable = false
shape = SubResource("RectangleShape2D_51e2h") shape = SubResource("RectangleShape2D_51e2h")
[node name="MeshInstance2D" type="MeshInstance2D" parent="CollisionShape2D"] [node name="MeshInstance2D" type="MeshInstance2D" parent="CollisionShape2D"]
visible = false
mesh = SubResource("QuadMesh_tumq0") mesh = SubResource("QuadMesh_tumq0")
texture = SubResource("GradientTexture2D_6phgx") texture = SubResource("GradientTexture2D_6phgx")

File diff suppressed because one or more lines are too long

View File

@ -1,9 +1,29 @@
[gd_scene load_steps=3 format=3 uid="uid://bu5cwjawsnb1q"] [gd_scene load_steps=10 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://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"]
[sub_resource type="PlaceholderTexture2D" id="PlaceholderTexture2D_erv1k"] [sub_resource type="LabelSettings" id="LabelSettings_ce3w2"]
size = Vector2(800, 160) font_size = 160
font_color = Color(1, 0.271, 0, 1)
[sub_resource type="LabelSettings" id="LabelSettings_n45e2"]
font_size = 160
font_color = Color(1, 1, 0, 1)
[sub_resource type="LabelSettings" id="LabelSettings_opfnp"]
font_size = 160
font_color = Color(0, 0, 1, 1)
[sub_resource type="LabelSettings" id="LabelSettings_cp0ys"]
font_size = 160
font_color = Color(0.545098, 0, 0, 1)
[sub_resource type="LabelSettings" id="LabelSettings_yhxw7"]
font_size = 160
font_color = Color(1, 1, 0, 1)
[node name="MainMenu" type="Control"] [node name="MainMenu" type="Control"]
layout_mode = 3 layout_mode = 3
@ -14,6 +34,10 @@ grow_horizontal = 2
grow_vertical = 2 grow_vertical = 2
script = ExtResource("1_28flt") script = ExtResource("1_28flt")
[node name="Background" type="Sprite2D" parent="."]
texture = ExtResource("2_48xlc")
centered = false
[node name="Container" type="Control" parent="."] [node name="Container" type="Control" parent="."]
layout_mode = 1 layout_mode = 1
anchors_preset = 0 anchors_preset = 0
@ -42,17 +66,79 @@ text = "Options"
layout_mode = 2 layout_mode = 2
text = "Quit" text = "Quit"
[node name="TextureRect" type="TextureRect" parent="."] [node name="Title" type="Control" parent="."]
layout_mode = 1 anchors_preset = 0
anchors_preset = -1 offset_left = -34.0
anchor_left = 0.1 offset_top = -2.0
anchor_top = 0.045 offset_right = 6.0
anchor_right = 0.9 offset_bottom = 38.0
anchor_bottom = 0.284
grow_horizontal = 2 [node name="Ouroboros" type="Sprite2D" parent="Title"]
grow_vertical = 2 modulate = Color(0.545, 0, 0, 1)
texture = SubResource("PlaceholderTexture2D_erv1k") position = Vector2(241, 130)
expand_mode = 2 texture = ExtResource("3_ce3w2")
script = ExtResource("4_n45e2")
[node name="Ouroboros2" type="Sprite2D" parent="Title"]
modulate = Color(0, 0.502, 0, 1)
position = Vector2(574, 176)
scale = Vector2(0.5, 0.5)
texture = ExtResource("3_ce3w2")
script = ExtResource("4_n45e2")
[node name="Ouroboros3" type="Sprite2D" parent="Title"]
modulate = Color(0.4, 0.2, 0.6, 1)
position = Vector2(776, 178)
scale = Vector2(0.5, 0.5)
texture = ExtResource("3_ce3w2")
script = ExtResource("4_n45e2")
[node name="Ouroboros4" type="Sprite2D" parent="Title"]
modulate = Color(1, 0.270588, 0, 1)
position = Vector2(947, 181)
scale = Vector2(0.5, 0.5)
texture = ExtResource("3_ce3w2")
script = ExtResource("4_n45e2")
[node name="Label" type="Label" parent="Title"]
offset_left = 351.0
offset_top = 49.0
offset_right = 522.0
offset_bottom = 268.0
text = "u"
label_settings = SubResource("LabelSettings_ce3w2")
[node name="Label5" type="Label" parent="Title"]
offset_left = 453.0
offset_top = 49.0
offset_right = 624.0
offset_bottom = 268.0
text = "r"
label_settings = SubResource("LabelSettings_n45e2")
[node name="Label2" type="Label" parent="Title"]
offset_left = 625.0
offset_top = 50.0
offset_right = 725.0
offset_bottom = 269.0
text = "b"
label_settings = SubResource("LabelSettings_opfnp")
[node name="Label3" type="Label" parent="Title"]
offset_left = 827.0
offset_top = 52.0
offset_right = 927.0
offset_bottom = 271.0
text = "r"
label_settings = SubResource("LabelSettings_cp0ys")
[node name="Label4" type="Label" parent="Title"]
offset_left = 998.0
offset_top = 51.0
offset_right = 1098.0
offset_bottom = 270.0
text = "s"
label_settings = SubResource("LabelSettings_yhxw7")
[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/Quit" to="." method="quit"] [connection signal="pressed" from="Buttons/Quit" to="." method="quit"]

View File

@ -1,7 +1,10 @@
[gd_scene load_steps=2 format=3 uid="uid://mp03fsd536be"] [gd_scene load_steps=3 format=3 uid="uid://mp03fsd536be"]
[ext_resource type="Script" uid="uid://bwiflwp3hufyu" path="res://Scripts/score_display.gd" id="1_abl27"] [ext_resource type="Script" uid="uid://bwiflwp3hufyu" path="res://Scripts/score_display.gd" id="1_abl27"]
[sub_resource type="LabelSettings" id="LabelSettings_abl27"]
font_size = 22
[node name="ScoreDisplay" type="VBoxContainer"] [node name="ScoreDisplay" type="VBoxContainer"]
anchors_preset = 15 anchors_preset = 15
anchor_right = 1.0 anchor_right = 1.0
@ -14,22 +17,40 @@ script = ExtResource("1_abl27")
layout_mode = 2 layout_mode = 2
text = "Score text = "Score
0" 0"
label_settings = SubResource("LabelSettings_abl27")
horizontal_alignment = 1 horizontal_alignment = 1
[node name="Spacer" type="Control" parent="."]
layout_mode = 2
size_flags_vertical = 3
[node name="LengthLabel" type="Label" parent="."] [node name="LengthLabel" type="Label" parent="."]
layout_mode = 2 layout_mode = 2
text = "Length text = "Length
3" 3"
label_settings = SubResource("LabelSettings_abl27")
horizontal_alignment = 1 horizontal_alignment = 1
[node name="Spacer2" type="Control" parent="."]
layout_mode = 2
size_flags_vertical = 3
[node name="PendingLengthLabel" type="Label" parent="."] [node name="PendingLengthLabel" type="Label" parent="."]
layout_mode = 2 layout_mode = 2
text = "Length text = "Eventual
Length
3" 3"
label_settings = SubResource("LabelSettings_abl27")
horizontal_alignment = 1 horizontal_alignment = 1
[node name="Spacer3" type="Control" parent="."]
layout_mode = 2
size_flags_vertical = 3
[node name="OuroborosPossibleLabel" type="Label" parent="."] [node name="OuroborosPossibleLabel" type="Label" parent="."]
layout_mode = 2 layout_mode = 2
text = "Ouroboros Possible text = "Ouroboros
Possible?
No" No"
label_settings = SubResource("LabelSettings_abl27")
horizontal_alignment = 1 horizontal_alignment = 1

View File

@ -20,8 +20,8 @@ func _ready() -> void:
var y_bounds : Vector2 = level.position.y * Vector2.ONE + Vector2(-TILE_SIZE, TILE_SIZE) * level.scale.y / 2 var y_bounds : Vector2 = level.position.y * Vector2.ONE + Vector2(-TILE_SIZE, TILE_SIZE) * level.scale.y / 2
# Determine the possible x and y coordinates # Determine the possible x and y coordinates
var possible_x : Array = range(x_bounds.x, x_bounds.y, TILE_SIZE) var possible_x : Array = range(x_bounds.x, x_bounds.y + 20, TILE_SIZE)
var possible_y : Array = range(y_bounds.x, y_bounds.y, TILE_SIZE) var possible_y : Array = range(y_bounds.x, y_bounds.y + 20, TILE_SIZE)
# Add each combination of x and y to the list of positions # Add each combination of x and y to the list of positions
for x in possible_x: for x in possible_x:

View File

@ -7,7 +7,7 @@ var score_label : Label = $FinalScore
func update_score() -> void: func update_score() -> void:
if score_label != null: if score_label != null:
score_label.text = "Final Score\n{score}".format(GameManager) score_label.text = "Final Score\n\n{score}".format(GameManager)
func restart(): func restart():
get_tree().change_scene_to_packed(load("res://Scenes/main.tscn")) get_tree().change_scene_to_packed(load("res://Scenes/main.tscn"))

View File

@ -0,0 +1,6 @@
extends Sprite2D
const ROTATION_SPEED = 0.2
func _process(delta: float) -> void:
rotate(delta * ROTATION_SPEED)

View File

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

9
Scripts/ouroboros.gd Normal file
View File

@ -0,0 +1,9 @@
extends Sprite2D
const ROTATION_SPEED = 0.2
func _process(delta: float) -> void:
var head = get_tree().get_first_node_in_group("Head")
if head is SnakePart:
rotate(delta * ROTATION_SPEED * (head.colour_index + 1))
modulate = head.COLOURS[head.colour_index]

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

@ -0,0 +1 @@
uid://8jbramxjbw1w

View File

@ -16,11 +16,11 @@ func _process(_delta: float) -> void:
length_label.text = "Length\n{0}".format([get_snake_length()]) length_label.text = "Length\n{0}".format([get_snake_length()])
var head : Node = get_tree().get_first_node_in_group("Head") var head : Node = get_tree().get_first_node_in_group("Head")
if head is SnakePart: if head is SnakePart:
pending_length_label.text = "Eventual Length\n{0}".format([get_snake_length() + head.queued_growth]) pending_length_label.text = "Eventual\nLength\n{0}".format([get_snake_length() + head.queued_growth])
if ouroboros_possible: if ouroboros_possible:
ouroboros_label.text = "Ouroboros Possible\nYes" ouroboros_label.text = "Ouroboros\nPossible?\nYes"
else: else:
ouroboros_label.text = "Ouroboros Possible\nNo" ouroboros_label.text = "Ouroboros\nPossible?\nNo"
func get_snake_length() -> int: func get_snake_length() -> int:
var length : int = 0 var length : int = 0

View File

@ -54,7 +54,7 @@ var image_tail : CompressedTexture2D = preload("res://Sprites/snake_tail.png")
var next_part : SnakePart = null var next_part : SnakePart = null
var commanding_head : SnakePart = null var commanding_head : SnakePart = null
var skip_next_move_propagation : bool = false var skip_next_move_propagation : bool = false
var queued_growth : int = 999 var queued_growth : int = 0
signal on_movement(new_dir, prevent_move) signal on_movement(new_dir, prevent_move)
signal on_death signal on_death
@ -74,8 +74,8 @@ func _ready() -> void:
var y_bounds : Vector2 = level.position.y * Vector2.ONE + Vector2(-TILE_SIZE, TILE_SIZE) * level.scale.y / 2 var y_bounds : Vector2 = level.position.y * Vector2.ONE + Vector2(-TILE_SIZE, TILE_SIZE) * level.scale.y / 2
# Determine the possible x and y coordinates # Determine the possible x and y coordinates
possible_x = range(x_bounds.x, x_bounds.y, TILE_SIZE) possible_x = range(x_bounds.x, x_bounds.y + 20, TILE_SIZE)
possible_y = range(y_bounds.x, y_bounds.y, TILE_SIZE) possible_y = range(y_bounds.x, y_bounds.y + 20, TILE_SIZE)
# Attach clock # Attach clock
var timer : Node = get_tree().get_first_node_in_group("GameClock") var timer : Node = get_tree().get_first_node_in_group("GameClock")

BIN
Sprites/background.kra Normal file

Binary file not shown.

BIN
Sprites/background.kra~ Normal file

Binary file not shown.

BIN
Sprites/background.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.2 MiB

View File

@ -0,0 +1,34 @@
[remap]
importer="texture"
type="CompressedTexture2D"
uid="uid://dxdtqv4do4x31"
path="res://.godot/imported/background.png-4fa92766cad903a1a79b587b09bd47c5.ctex"
metadata={
"vram_texture": false
}
[deps]
source_file="res://Sprites/background.png"
dest_files=["res://.godot/imported/background.png-4fa92766cad903a1a79b587b09bd47c5.ctex"]
[params]
compress/mode=0
compress/high_quality=false
compress/lossy_quality=0.7
compress/hdr_compression=1
compress/normal_map=0
compress/channel_pack=0
mipmaps/generate=false
mipmaps/limit=-1
roughness/mode=0
roughness/src_normal=""
process/fix_alpha_border=true
process/premult_alpha=false
process/normal_map_invert_y=false
process/hdr_as_srgb=false
process/hdr_clamp_exposure=false
process/size_limit=0
detect_3d/compress_to=1

BIN
Sprites/ouroboros.kra Normal file

Binary file not shown.

BIN
Sprites/ouroboros.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 4.1 KiB

View File

@ -0,0 +1,34 @@
[remap]
importer="texture"
type="CompressedTexture2D"
uid="uid://c6kno4vjbvu28"
path="res://.godot/imported/ouroboros.png-da3a5483a878ddf056c771fe7aa64ca9.ctex"
metadata={
"vram_texture": false
}
[deps]
source_file="res://Sprites/ouroboros.png"
dest_files=["res://.godot/imported/ouroboros.png-da3a5483a878ddf056c771fe7aa64ca9.ctex"]
[params]
compress/mode=0
compress/high_quality=false
compress/lossy_quality=0.7
compress/hdr_compression=1
compress/normal_map=0
compress/channel_pack=0
mipmaps/generate=false
mipmaps/limit=-1
roughness/mode=0
roughness/src_normal=""
process/fix_alpha_border=true
process/premult_alpha=false
process/normal_map_invert_y=false
process/hdr_as_srgb=false
process/hdr_clamp_exposure=false
process/size_limit=0
detect_3d/compress_to=1

View File

@ -61,3 +61,4 @@ up={
renderer/rendering_method="gl_compatibility" renderer/rendering_method="gl_compatibility"
renderer/rendering_method.mobile="gl_compatibility" renderer/rendering_method.mobile="gl_compatibility"
2d/snap/snap_2d_transforms_to_pixel=true