From 0f06846157a322f2bd29e9345d7c9ec6229c50ba Mon Sep 17 00:00:00 2001 From: MartinOpat Date: Sat, 7 Feb 2026 17:50:29 +0100 Subject: [PATCH] Food boundary + animation sprite --- evolve-die-repeat/molecular/food/food_mol.gd | 2 + .../molecular/food/food_mol.tscn | 56 +++++++++++++++++++ 2 files changed, 58 insertions(+) diff --git a/evolve-die-repeat/molecular/food/food_mol.gd b/evolve-die-repeat/molecular/food/food_mol.gd index ba8d73d..2bdb694 100644 --- a/evolve-die-repeat/molecular/food/food_mol.gd +++ b/evolve-die-repeat/molecular/food/food_mol.gd @@ -1,6 +1,8 @@ extends AbstractFood class_name FoodMolecular +func _ready() -> void: + $AnimatedSprite2D.play() func _on_body_entered(body: Node2D) -> void: eat(body) diff --git a/evolve-die-repeat/molecular/food/food_mol.tscn b/evolve-die-repeat/molecular/food/food_mol.tscn index 17a947a..2e15269 100644 --- a/evolve-die-repeat/molecular/food/food_mol.tscn +++ b/evolve-die-repeat/molecular/food/food_mol.tscn @@ -2,10 +2,55 @@ [ext_resource type="Script" uid="uid://cayxffay17o0u" path="res://molecular/food/food_mol.gd" id="1_0vfbj"] [ext_resource type="Texture2D" uid="uid://dcedkos6vgv51" path="res://molecular/assets/food/food-normal.png" id="2_68e2u"] +[ext_resource type="Script" uid="uid://bvbc0n0pslq7p" path="res://shared/wrapping_manager.gd" id="3_8lhj0"] +[ext_resource type="Texture2D" uid="uid://xaqiha5lh1vt" path="res://molecular/assets/food/food-left-bolt.png" id="4_88m7w"] +[ext_resource type="Texture2D" uid="uid://dj4lyyloj1ke1" path="res://molecular/assets/food/food-left-bottom-bolt.png" id="5_i3g2v"] +[ext_resource type="Texture2D" uid="uid://cbynycukppmup" path="res://molecular/assets/food/food-right-bottom-bolt.png" id="6_07uaq"] [sub_resource type="CircleShape2D" id="CircleShape2D_0vfbj"] radius = 2.0 +[sub_resource type="SpriteFrames" id="SpriteFrames_oo5vd"] +animations = [{ +"frames": [{ +"duration": 1.0, +"texture": ExtResource("2_68e2u") +}, { +"duration": 1.0, +"texture": ExtResource("4_88m7w") +}, { +"duration": 1.0, +"texture": ExtResource("2_68e2u") +}, { +"duration": 1.0, +"texture": ExtResource("2_68e2u") +}, { +"duration": 1.0, +"texture": ExtResource("5_i3g2v") +}, { +"duration": 1.0, +"texture": ExtResource("2_68e2u") +}, { +"duration": 1.0, +"texture": ExtResource("4_88m7w") +}, { +"duration": 1.0, +"texture": ExtResource("6_07uaq") +}, { +"duration": 1.0, +"texture": ExtResource("2_68e2u") +}, { +"duration": 1.0, +"texture": ExtResource("2_68e2u") +}, { +"duration": 1.0, +"texture": ExtResource("2_68e2u") +}], +"loop": true, +"name": &"default", +"speed": 5.0 +}] + [node name="FoodMol" type="Area2D" unique_id=595352294] collision_layer = 8 collision_mask = 7 @@ -15,7 +60,18 @@ script = ExtResource("1_0vfbj") shape = SubResource("CircleShape2D_0vfbj") [node name="Sprite2D" type="Sprite2D" parent="." unique_id=98693723] +visible = false scale = Vector2(0.385, 0.385) texture = ExtResource("2_68e2u") +[node name="WrappingManager" type="Node" parent="." unique_id=1406150436 node_paths=PackedStringArray("sprite")] +script = ExtResource("3_8lhj0") +sprite = NodePath("../AnimatedSprite2D") +metadata/_custom_type_script = "uid://bvbc0n0pslq7p" + +[node name="AnimatedSprite2D" type="AnimatedSprite2D" parent="." unique_id=1856148995] +scale = Vector2(0.385, 0.385) +sprite_frames = SubResource("SpriteFrames_oo5vd") +frame_progress = 0.9373464 + [connection signal="body_entered" from="." to="." method="_on_body_entered"]