[gd_scene 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/prey/nucleotide_prey.gd" id="2_0227s"]
[ext_resource type="Texture2D" uid="uid://bhcb5g7g7um8" path="res://molecular/assets/prey/prey-dying-frame0.png" id="2_lkj7f"]
[ext_resource type="Texture2D" uid="uid://bxn11avw7dykl" path="res://molecular/assets/prey/prey-dying-frame1.png" id="3_svqyr"]
[ext_resource type="Texture2D" uid="uid://ctkehsavw6ghx" path="res://molecular/assets/prey/prey-healthy-frame0.png" id="4_ee1gb"]
[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://0vwv2nt16gpv" path="res://molecular/prey/state_machine.gd" id="9_xxtgy"]
[ext_resource type="Script" uid="uid://ubcu8fdfxxj1" path="res://molecular/prey/state_random_movement.gd" id="10_rgguv"]
[ext_resource type="Script" uid="uid://xbiqj7ubmj7d" path="res://molecular/prey/state_idle.gd" id="12_ubfhk"]
[ext_resource type="Script" uid="uid://dlw7inlh6asvu" path="res://molecular/prey/state_fleeing.gd" id="12_xxtgy"]

[sub_resource type="SpriteFrames" id="SpriteFrames_66x8p"]
animations = [{
"frames": [{
"duration": 1.0,
"texture": ExtResource("2_lkj7f")
}, {
"duration": 20.0,
"texture": ExtResource("3_svqyr")
}],
"loop": true,
"name": &"Dying",
"speed": 1.0
}, {
"frames": [{
"duration": 1.0,
"texture": ExtResource("4_ee1gb")
}, {
"duration": 20.0,
"texture": ExtResource("5_ae5nf")
}],
"loop": true,
"name": &"Healthy",
"speed": 1.0
}, {
"frames": [{
"duration": 1.0,
"texture": ExtResource("6_0f87h")
}, {
"duration": 20.0,
"texture": ExtResource("7_w7inl")
}],
"loop": true,
"name": &"Injured",
"speed": 1.0
}]

[node name="NucleotidePrey" unique_id=740525631 groups=["prey"] instance=ExtResource("1_qvulj")]
collision_layer = 2
collision_mask = 5
motion_mode = 1
script = ExtResource("2_0227s")
speed = 0.5
maxHealth = 20

[node name="AnimatedSprite2D" type="AnimatedSprite2D" parent="." index="0" unique_id=788182944]
rotation = 1.5707964
scale = Vector2(0.1, 0.1)
sprite_frames = SubResource("SpriteFrames_66x8p")
animation = &"Healthy"

[node name="CollisionPolygon2D" parent="." index="1"]
light_mask = 2
visibility_layer = 2
position = Vector2(6.929083, 3.0664783)
rotation = 0.474154
polygon = PackedVector2Array(-8.831272, -2.3390446, -5.7760534, -2.3993049, -4.0230684, 0.41277456, -5.8890305, 2.9948444, -8.862037, 2.9326901, -10.268076, 0.28495264)

[node name="StateMachine" type="Node" parent="." index="2" unique_id=445822474 node_paths=PackedStringArray("initial_state")]
script = ExtResource("9_xxtgy")
initial_state = NodePath("Idle")

[node name="RandomMovement" type="Node" parent="StateMachine" index="0" unique_id=1422146232]
script = ExtResource("10_rgguv")

[node name="Timer" type="Timer" parent="StateMachine/RandomMovement" index="0" unique_id=593528934]
one_shot = true

[node name="Fleeing" type="Node" parent="StateMachine" index="1" unique_id=1125485674]
script = ExtResource("12_xxtgy")

[node name="Idle" type="Node" parent="StateMachine" index="2" unique_id=1424222731]
script = ExtResource("12_ubfhk")

[node name="Timer" type="Timer" parent="StateMachine/Idle" index="0" unique_id=1050348256]
one_shot = true

[node name="Sight" type="Area2D" parent="." index="3" unique_id=1773478588]
collision_layer = 0
collision_mask = 7

[node name="CollisionPolygon2D" type="CollisionPolygon2D" parent="Sight" index="0" unique_id=338757598]
light_mask = 2
visibility_layer = 2
rotation = 1.5707964
polygon = PackedVector2Array(3.8686981, -6.2705374, 7.0000973, -0.08602524, 3.5555592, 5.6287766, -3.0986624, 5.589636, -6.1517763, 0.031402588, -2.942093, -6.0748243, -29.993027, -74.37026, -11.10141, -83.6233, 9.332382, -84.00884, 35.163773, -77.06906)

[connection signal="timeout" from="StateMachine/RandomMovement/Timer" to="StateMachine/RandomMovement" method="_on_timer_timeout"]
[connection signal="timeout" from="StateMachine/Idle/Timer" to="StateMachine/Idle" method="_on_timer_timeout"]
[connection signal="body_entered" from="Sight" to="." method="_on_sight_body_entered"]
