[gd_scene load_steps=13 format=3 uid="uid://c5ruphrd8ebuu"]

[ext_resource type="Script" uid="uid://dailpwkay2nu5" path="res://ennemy/armored_ennemy.gd" id="1_f4v0e"]
[ext_resource type="Shape2D" uid="uid://6rhdwj5jxbxn" path="res://player/player_collision.tres" id="2_f4v0e"]
[ext_resource type="Texture2D" uid="uid://cjruk5xlt3tyn" path="res://ennemy/MechantVol.png" id="2_iblih"]
[ext_resource type="PackedScene" uid="uid://7sqwi3lygb1u" path="res://damageable/hitbox.tscn" id="4_e5h8j"]
[ext_resource type="AudioStream" uid="uid://c0w61do2a1hbc" path="res://ennemy/black-magic-159868.mp3" id="5_iblih"]

[sub_resource type="AtlasTexture" id="AtlasTexture_iblih"]
atlas = ExtResource("2_iblih")
region = Rect2(96, 0, 32, 32)

[sub_resource type="AtlasTexture" id="AtlasTexture_vaovl"]
atlas = ExtResource("2_iblih")
region = Rect2(128, 0, 32, 32)

[sub_resource type="AtlasTexture" id="AtlasTexture_i1xbb"]
atlas = ExtResource("2_iblih")
region = Rect2(64, 0, 32, 32)

[sub_resource type="AtlasTexture" id="AtlasTexture_0a3sv"]
atlas = ExtResource("2_iblih")
region = Rect2(96, 0, 32, 32)

[sub_resource type="SpriteFrames" id="SpriteFrames_vaovl"]
animations = [{
"frames": [{
"duration": 1.0,
"texture": SubResource("AtlasTexture_iblih")
}, {
"duration": 1.0,
"texture": SubResource("AtlasTexture_vaovl")
}],
"loop": true,
"name": &"hit",
"speed": 6.0
}, {
"frames": [{
"duration": 1.0,
"texture": SubResource("AtlasTexture_i1xbb")
}, {
"duration": 1.0,
"texture": SubResource("AtlasTexture_0a3sv")
}],
"loop": true,
"name": &"idle",
"speed": 2.0
}]

[sub_resource type="RectangleShape2D" id="RectangleShape2D_f4v0e"]

[sub_resource type="CircleShape2D" id="CircleShape2D_e5h8j"]

[node name="ArmoredEnnemy" type="CharacterBody2D"]
script = ExtResource("1_f4v0e")

[node name="AnimatedSprite2D" type="AnimatedSprite2D" parent="."]
position = Vector2(1, -16)
sprite_frames = SubResource("SpriteFrames_vaovl")
animation = &"idle"
autoplay = "idle"

[node name="CollisionShape2D" type="CollisionShape2D" parent="."]
position = Vector2(0, -13)
shape = ExtResource("2_f4v0e")

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

[node name="CollisionShape2D" type="CollisionShape2D" parent="TriggerHit"]
position = Vector2(17, -15)
shape = SubResource("RectangleShape2D_f4v0e")

[node name="Hitbox" parent="." instance=ExtResource("4_e5h8j")]
collision_mask = 3
hitback_direction = Vector2(1, -1)

[node name="CollisionShape2D" type="CollisionShape2D" parent="Hitbox"]
position = Vector2(17, -15)
shape = SubResource("CircleShape2D_e5h8j")

[node name="TimeToFinishHit" type="Timer" parent="."]
wait_time = 0.5
one_shot = true

[node name="AudioStreamPlayer2D" type="AudioStreamPlayer2D" parent="."]
stream = ExtResource("5_iblih")
autoplay = true
max_distance = 400.0
bus = &"BadGuy"

[connection signal="body_entered" from="TriggerHit" to="." method="_on_trigger_hit_body_entered"]
[connection signal="timeout" from="TimeToFinishHit" to="." method="_on_time_to_finish_hit_timeout"]
