[gd_scene load_steps=11 format=3 uid="uid://bnxx7nnifjica"]

[ext_resource type="PackedScene" uid="uid://b18cf4i8v6a1" path="res://scenes/game/entities/entity.tscn" id="1_bf5v6"]
[ext_resource type="Script" path="res://scenes/game/entities/Enemy/enemy.gd" id="2_4vapd"]
[ext_resource type="Texture2D" uid="uid://cjmden6nkwf1x" path="res://Assets/Enemy/Ghost.png" id="3_uks2p"]
[ext_resource type="PackedScene" uid="uid://cwirujaquehfc" path="res://scenes/game/Hitbox/damage_area.tscn" id="4_mr72k"]

[sub_resource type="CircleShape2D" id="CircleShape2D_xq7op"]
radius = 8.0

[sub_resource type="CanvasItemMaterial" id="CanvasItemMaterial_c882v"]
light_mode = 2

[sub_resource type="AtlasTexture" id="AtlasTexture_siy4x"]
atlas = ExtResource("3_uks2p")
region = Rect2(0, 0, 16, 16)

[sub_resource type="SpriteFrames" id="SpriteFrames_i6h2x"]
animations = [{
"frames": [{
"duration": 1.0,
"texture": SubResource("AtlasTexture_siy4x")
}],
"loop": true,
"name": &"default",
"speed": 5.0
}]

[sub_resource type="CapsuleShape2D" id="CapsuleShape2D_w20ih"]
radius = 128.0
height = 384.0

[sub_resource type="CircleShape2D" id="CircleShape2D_eto3a"]
radius = 16.0

[node name="Enemy" groups=["Enemy"] instance=ExtResource("1_bf5v6")]
collision_layer = 2560
script = ExtResource("2_4vapd")
damage = 1
attackCooldown = 1
normalSpeed = 70

[node name="CollisionShape2D" parent="." index="0"]
shape = SubResource("CircleShape2D_xq7op")

[node name="AnimatedSprite2D" parent="." index="1"]
material = SubResource("CanvasItemMaterial_c882v")
scale = Vector2(1, 1)
sprite_frames = SubResource("SpriteFrames_i6h2x")

[node name="NavigationAgent" type="NavigationAgent2D" parent="." index="2"]
path_postprocessing = 1
simplify_path = true
avoidance_enabled = true
avoidance_layers = 2560
avoidance_mask = 3630
debug_use_custom = true
debug_path_custom_color = Color(1, 0, 0, 1)

[node name="Radius" type="Area2D" parent="." index="3" groups=["Enemy"]]
collision_layer = 3687
collision_mask = 1024

[node name="CollisionShape2D" type="CollisionShape2D" parent="Radius" index="0"]
rotation = -1.57079
shape = SubResource("CapsuleShape2D_w20ih")

[node name="RayCast2D" type="RayCast2D" parent="Radius" index="1"]
target_position = Vector2(-12.48, 16)
collision_mask = 14
hit_from_inside = true

[node name="DamageArea" parent="." index="4" instance=ExtResource("4_mr72k")]

[node name="CollisionShape2D" parent="DamageArea" index="0"]
shape = SubResource("CircleShape2D_eto3a")

[node name="AttackCooldown" type="Timer" parent="." index="5"]
one_shot = true

[connection signal="velocity_computed" from="NavigationAgent" to="." method="_on_navigation_agent_velocity_computed"]
[connection signal="body_entered" from="Radius" to="." method="_on_radius_body_entered"]
[connection signal="body_exited" from="Radius" to="." method="_on_radius_body_exited"]
[connection signal="draw" from="Radius/RayCast2D" to="." method="_on_ray_cast_2d_draw"]
[connection signal="area_entered" from="DamageArea" to="." method="_on_damage_area_area_entered"]
[connection signal="area_exited" from="DamageArea" to="." method="_on_damage_area_area_exited"]
[connection signal="timeout" from="AttackCooldown" to="." method="_on_attack_cooldown_timeout"]

[editable path="DamageArea"]
