Adds graphics for fruit

master
TechieDamien 2025-08-01 12:31:21 +01:00
parent 6899c1063c
commit 2eb0324eff
Signed by: TechieDamien
GPG Key ID: 2ACE3574E164B780
17 changed files with 202 additions and 7 deletions

View File

@ -18,6 +18,7 @@ shape = SubResource("RectangleShape2D_hf2pu")
texture = SubResource("PlaceholderTexture2D_kum7e")
[node name="Label" type="Label" parent="."]
visible = false
anchors_preset = 8
anchor_left = 0.5
anchor_top = 0.5

View File

@ -1,4 +1,4 @@
[gd_scene load_steps=12 format=4 uid="uid://bs6an72avch86"]
[gd_scene load_steps=16 format=4 uid="uid://bs6an72avch86"]
[ext_resource type="Texture2D" uid="uid://dxdtqv4do4x31" path="res://Sprites/background.png" id="1_6bp64"]
[ext_resource type="PackedScene" uid="uid://gkqku38yb2ng" path="res://Scenes/level.tscn" id="1_bo1nx"]
@ -9,6 +9,10 @@
[ext_resource type="Texture2D" uid="uid://dr54j1cutgpf2" path="res://Sprites/tile.png" id="6_21xkr"]
[ext_resource type="Texture2D" uid="uid://c6kno4vjbvu28" path="res://Sprites/ouroboros.png" id="8_ynf5e"]
[ext_resource type="Script" uid="uid://8jbramxjbw1w" path="res://Scripts/ouroboros.gd" id="9_hptm8"]
[ext_resource type="Texture2D" uid="uid://bbutodjdye61j" path="res://Sprites/cherry.png" id="10_fdnlq"]
[ext_resource type="Texture2D" uid="uid://dr3y3mvyrecxn" path="res://Sprites/lemon.png" id="11_jkdf5"]
[ext_resource type="Texture2D" uid="uid://csu4d06po6r6x" path="res://Sprites/apple.png" id="12_wsu2k"]
[ext_resource type="Texture2D" uid="uid://ccqroki031ou" path="res://Sprites/watermelon.png" id="13_k12tt"]
[sub_resource type="TileSetAtlasSource" id="TileSetAtlasSource_6bp64"]
resource_name = "Tile"
@ -55,10 +59,10 @@ position = Vector2(707, 325)
[node name="RestartTimer" type="Timer" parent="." groups=["GameClockPause"]]
[node name="ScoreDisplay" parent="." instance=ExtResource("4_jjvhh")]
offset_left = 4.0
offset_top = 188.0
offset_right = 156.0
offset_bottom = 602.0
offset_left = 6.0
offset_top = 155.0
offset_right = 158.0
offset_bottom = 526.0
[node name="GameOverMenu" parent="." instance=ExtResource("5_kry3j")]
z_index = 1
@ -79,9 +83,56 @@ tile_map_data = PackedByteArray("AAADAAAAAAAAAAAAAAAEAAAAAAAAAAAAAAAFAAAAAAAAAAA
tile_set = SubResource("TileSet_344ge")
[node name="Ouroboros" type="Sprite2D" parent="."]
position = Vector2(86, 97)
position = Vector2(84, 90)
scale = Vector2(0.5, 0.5)
texture = ExtResource("8_ynf5e")
script = ExtResource("9_hptm8")
[node name="FruitExamples" type="Node2D" parent="."]
position = Vector2(-1, 56)
[node name="Cherry" type="Sprite2D" parent="FruitExamples"]
position = Vector2(39, 503)
texture = ExtResource("10_fdnlq")
[node name="Lemon" type="Sprite2D" parent="FruitExamples"]
position = Vector2(38, 542)
texture = ExtResource("11_jkdf5")
[node name="Apple" type="Sprite2D" parent="FruitExamples"]
position = Vector2(93, 509)
texture = ExtResource("12_wsu2k")
[node name="Watermelon" type="Sprite2D" parent="FruitExamples"]
position = Vector2(92, 541)
texture = ExtResource("13_k12tt")
[node name="Label" type="Label" parent="FruitExamples"]
offset_left = 56.0
offset_top = 496.0
offset_right = 96.0
offset_bottom = 519.0
text = "=1"
[node name="Label2" type="Label" parent="FruitExamples"]
offset_left = 55.0
offset_top = 530.0
offset_right = 95.0
offset_bottom = 553.0
text = "=3"
[node name="Label3" type="Label" parent="FruitExamples"]
offset_left = 112.0
offset_top = 496.0
offset_right = 152.0
offset_bottom = 519.0
text = "=5"
[node name="Label4" type="Label" parent="FruitExamples"]
offset_left = 113.0
offset_top = 527.0
offset_right = 153.0
offset_bottom = 550.0
text = "=10"
[connection signal="timeout" from="RestartTimer" to="Timer" method="start" binds= [0.3]]

View File

@ -7,10 +7,17 @@ var all_positions : Array[Vector2] = []
const possible_growth_amounts = [1,1,1,3,3,5,10]
const growth_sprite_map : Dictionary[int, CompressedTexture2D] = {1: preload("res://Sprites/cherry.png"),
3: preload("res://Sprites/lemon.png"),
5: preload("res://Sprites/apple.png"),
10: preload("res://Sprites/watermelon.png")}
var growth_amount : int = 1
@onready
var label : Label = $Label
@onready
var sprite : Sprite2D = $Sprite2D
func _ready() -> void:
@ -63,3 +70,4 @@ func respawn() -> void:
position = chosen_position
growth_amount = possible_growth_amounts.pick_random()
label.text = str(growth_amount)
sprite.texture = growth_sprite_map[growth_amount]

View File

@ -319,7 +319,6 @@ func extend() -> void:
func lose_game(from_lack_of_space : bool = false) -> void:
# You lose!
print("Game lost")
if !from_lack_of_space:
state = States.DEAD
on_death.emit()

BIN
Sprites/apple.kra Normal file

Binary file not shown.

BIN
Sprites/apple.kra~ Normal file

Binary file not shown.

BIN
Sprites/apple.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 496 B

34
Sprites/apple.png.import Normal file
View File

@ -0,0 +1,34 @@
[remap]
importer="texture"
type="CompressedTexture2D"
uid="uid://csu4d06po6r6x"
path="res://.godot/imported/apple.png-f244e7ecb5b99913355a5f62514bf77f.ctex"
metadata={
"vram_texture": false
}
[deps]
source_file="res://Sprites/apple.png"
dest_files=["res://.godot/imported/apple.png-f244e7ecb5b99913355a5f62514bf77f.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/cherry.kra Normal file

Binary file not shown.

BIN
Sprites/cherry.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 514 B

34
Sprites/cherry.png.import Normal file
View File

@ -0,0 +1,34 @@
[remap]
importer="texture"
type="CompressedTexture2D"
uid="uid://bbutodjdye61j"
path="res://.godot/imported/cherry.png-1268bc62a5bd7130d3e2aecdb79a7fed.ctex"
metadata={
"vram_texture": false
}
[deps]
source_file="res://Sprites/cherry.png"
dest_files=["res://.godot/imported/cherry.png-1268bc62a5bd7130d3e2aecdb79a7fed.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/lemon.kra Normal file

Binary file not shown.

BIN
Sprites/lemon.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 557 B

34
Sprites/lemon.png.import Normal file
View File

@ -0,0 +1,34 @@
[remap]
importer="texture"
type="CompressedTexture2D"
uid="uid://dr3y3mvyrecxn"
path="res://.godot/imported/lemon.png-73e08c0ca3977d3d7574347d6beaf193.ctex"
metadata={
"vram_texture": false
}
[deps]
source_file="res://Sprites/lemon.png"
dest_files=["res://.godot/imported/lemon.png-73e08c0ca3977d3d7574347d6beaf193.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/watermelon.kra Normal file

Binary file not shown.

BIN
Sprites/watermelon.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 530 B

View File

@ -0,0 +1,34 @@
[remap]
importer="texture"
type="CompressedTexture2D"
uid="uid://ccqroki031ou"
path="res://.godot/imported/watermelon.png-2d326c220bb3be661e45fe595311d67b.ctex"
metadata={
"vram_texture": false
}
[deps]
source_file="res://Sprites/watermelon.png"
dest_files=["res://.godot/imported/watermelon.png-2d326c220bb3be661e45fe595311d67b.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