Food boundary + animation sprite

This commit is contained in:
2026-02-07 17:50:29 +01:00
parent 1dc1501b80
commit 0f06846157
2 changed files with 58 additions and 0 deletions

View File

@@ -1,6 +1,8 @@
extends AbstractFood extends AbstractFood
class_name FoodMolecular class_name FoodMolecular
func _ready() -> void:
$AnimatedSprite2D.play()
func _on_body_entered(body: Node2D) -> void: func _on_body_entered(body: Node2D) -> void:
eat(body) eat(body)

View File

@@ -2,10 +2,55 @@
[ext_resource type="Script" uid="uid://cayxffay17o0u" path="res://molecular/food/food_mol.gd" id="1_0vfbj"] [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="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"] [sub_resource type="CircleShape2D" id="CircleShape2D_0vfbj"]
radius = 2.0 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] [node name="FoodMol" type="Area2D" unique_id=595352294]
collision_layer = 8 collision_layer = 8
collision_mask = 7 collision_mask = 7
@@ -15,7 +60,18 @@ script = ExtResource("1_0vfbj")
shape = SubResource("CircleShape2D_0vfbj") shape = SubResource("CircleShape2D_0vfbj")
[node name="Sprite2D" type="Sprite2D" parent="." unique_id=98693723] [node name="Sprite2D" type="Sprite2D" parent="." unique_id=98693723]
visible = false
scale = Vector2(0.385, 0.385) scale = Vector2(0.385, 0.385)
texture = ExtResource("2_68e2u") 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"] [connection signal="body_entered" from="." to="." method="_on_body_entered"]