ft (Wip): FSM behaviour prey

This commit is contained in:
2026-01-23 10:48:14 +01:00
parent 0b9b1e75d4
commit c11afd9ddd
24 changed files with 154 additions and 54 deletions

View File

@@ -1,4 +1,4 @@
[gd_scene load_steps=10 format=3 uid="uid://c3iw2v3x6ngrb"]
[gd_scene load_steps=12 format=3 uid="uid://c3iw2v3x6ngrb"]
[ext_resource type="PackedScene" uid="uid://bvsdg1v3ksixy" path="res://shared/npc/prey2D.tscn" id="1_qvulj"]
[ext_resource type="Script" uid="uid://bgossk6xo31gi" path="res://molecular/nucleotide_prey.gd" id="2_0227s"]
@@ -8,11 +8,13 @@
[ext_resource type="Texture2D" uid="uid://uy28y3mkk6nt" path="res://molecular/assets/prey/prey-healthy-frame1.png" id="5_ae5nf"]
[ext_resource type="Texture2D" uid="uid://btnyajci8ptb2" path="res://molecular/assets/prey/prey-injured-frame0.png" id="6_0f87h"]
[ext_resource type="Texture2D" uid="uid://bqll8ge4cr2uf" path="res://molecular/assets/prey/prey-injured-frame1.png" id="7_w7inl"]
[ext_resource type="Script" uid="uid://c7o7sp02u0wkv" path="res://molecular/nucleotide_prey_state.gd" id="9_guu3v"]
[ext_resource type="Script" uid="uid://ubcu8fdfxxj1" path="res://molecular/nucleotide_prey_foraging.gd" id="10_rgguv"]
[sub_resource type="SpriteFrames" id="SpriteFrames_66x8p"]
animations = [{
"frames": [{
"duration": 20.0,
"duration": 1.0,
"texture": ExtResource("2_lkj7f")
}, {
"duration": 20.0,
@@ -23,7 +25,7 @@ animations = [{
"speed": 1.0
}, {
"frames": [{
"duration": 20.0,
"duration": 1.0,
"texture": ExtResource("4_ee1gb")
}, {
"duration": 20.0,
@@ -34,7 +36,7 @@ animations = [{
"speed": 1.0
}, {
"frames": [{
"duration": 20.0,
"duration": 1.0,
"texture": ExtResource("6_0f87h")
}, {
"duration": 20.0,
@@ -54,4 +56,17 @@ maxHealth = 20
[node name="AnimatedSprite2D" type="AnimatedSprite2D" parent="." index="0"]
scale = Vector2(0.1, 0.1)
sprite_frames = SubResource("SpriteFrames_66x8p")
animation = &"Dying"
animation = &"Injured"
[node name="State" type="Node" parent="." index="2"]
script = ExtResource("9_guu3v")
metadata/_custom_type_script = "uid://co2xp7gauamql"
[node name="Foraging" type="Node" parent="State" index="0"]
script = ExtResource("10_rgguv")
metadata/_custom_type_script = "uid://c7o7sp02u0wkv"
[node name="Timer" type="Timer" parent="State/Foraging" index="0"]
one_shot = true
[connection signal="timeout" from="State/Foraging/Timer" to="State/Foraging" method="_on_timer_timeout"]