[gd_scene load_steps=12 format=3 uid="uid://sr8t2lu6apr4"]

[ext_resource type="Texture2D" uid="uid://c886j66l82ncy" path="res://assets/textures/spritesheets/skull.png" id="1_04wrl"]
[ext_resource type="Script" uid="uid://cuc28u7op02gq" path="res://scripts/enemies/skull.gd" id="1_xx1px"]
[ext_resource type="PackedScene" uid="uid://de71apm4hg6i" path="res://scenes/fightable.tscn" id="3_3gsvf"]

[sub_resource type="CapsuleShape2D" id="CapsuleShape2D_04wrl"]
radius = 9.0

[sub_resource type="CircleShape2D" id="CircleShape2D_04wrl"]
radius = 250.79872

[sub_resource type="CircleShape2D" id="CircleShape2D_xx1px"]
radius = 35.014282

[sub_resource type="AtlasTexture" id="AtlasTexture_3gsvf"]
atlas = ExtResource("1_04wrl")
region = Rect2(0, 0, 32, 64)

[sub_resource type="AtlasTexture" id="AtlasTexture_17hur"]
atlas = ExtResource("1_04wrl")
region = Rect2(32, 0, 32, 64)

[sub_resource type="AtlasTexture" id="AtlasTexture_lgdni"]
atlas = ExtResource("1_04wrl")
region = Rect2(64, 0, 32, 64)

[sub_resource type="AtlasTexture" id="AtlasTexture_7f2rg"]
atlas = ExtResource("1_04wrl")
region = Rect2(96, 0, 32, 64)

[sub_resource type="SpriteFrames" id="SpriteFrames_bidx4"]
animations = [{
"frames": [{
"duration": 1.0,
"texture": SubResource("AtlasTexture_3gsvf")
}, {
"duration": 1.0,
"texture": SubResource("AtlasTexture_17hur")
}, {
"duration": 1.0,
"texture": SubResource("AtlasTexture_lgdni")
}, {
"duration": 1.0,
"texture": SubResource("AtlasTexture_7f2rg")
}, {
"duration": 1.0,
"texture": SubResource("AtlasTexture_lgdni")
}, {
"duration": 1.0,
"texture": SubResource("AtlasTexture_3gsvf")
}],
"loop": true,
"name": &"default",
"speed": 10.0
}]

[node name="Skull" type="CharacterBody2D"]
y_sort_enabled = true
collision_layer = 0
collision_mask = 2
script = ExtResource("1_xx1px")

[node name="CollisionShape2D" type="CollisionShape2D" parent="."]
position = Vector2(1, 11)
rotation = 1.5707964
shape = SubResource("CapsuleShape2D_04wrl")

[node name="NavigationAgent2D" type="NavigationAgent2D" parent="."]
avoidance_enabled = true
radius = 16.0

[node name="VisibleOnScreenEnabler2D" type="VisibleOnScreenEnabler2D" parent="."]

[node name="Area2D" type="Area2D" parent="."]
collision_layer = 0
collision_mask = 2

[node name="CollisionShape2D" type="CollisionShape2D" parent="Area2D" groups=["Enemy"]]
shape = SubResource("CircleShape2D_04wrl")
debug_color = Color(0.49019608, 0.5137255, 0.75686276, 0)

[node name="FollowUpdateTimer" type="Timer" parent="."]

[node name="AttackTimer" type="Timer" parent="."]

[node name="AttackArea" type="Area2D" parent="."]
collision_layer = 0
collision_mask = 2

[node name="CollisionShape2D" type="CollisionShape2D" parent="AttackArea"]
position = Vector2(1, -8)
shape = SubResource("CircleShape2D_xx1px")
debug_color = Color(0.7831714, 0.38409948, 0.54320604, 0.41960785)

[node name="AnimatedSprite2D" type="AnimatedSprite2D" parent="."]
position = Vector2(0, -15)
sprite_frames = SubResource("SpriteFrames_bidx4")

[node name="Fightable" parent="." instance=ExtResource("3_3gsvf")]

[connection signal="velocity_computed" from="NavigationAgent2D" to="." method="_on_navigation_agent_2d_velocity_computed"]
[connection signal="body_entered" from="Area2D" to="." method="_on_area_body_entered"]
[connection signal="body_exited" from="Area2D" to="." method="_on_area_body_exited"]
[connection signal="timeout" from="FollowUpdateTimer" to="." method="_on_follow_update_timer_timeout"]
[connection signal="timeout" from="AttackTimer" to="." method="_on_attack_timer_timeout"]
[connection signal="body_entered" from="AttackArea" to="." method="_on_attack_area_body_entered"]
[connection signal="body_exited" from="AttackArea" to="." method="_on_attack_area_body_exited"]
[connection signal="fought" from="Fightable" to="." method="_on_fightable_fought"]
