[gd_scene load_steps=16 format=3 uid="uid://cllmxp5oqhs5a"]

[ext_resource type="Script" uid="uid://d00tcsqfapyp1" path="res://scripts/enemy.gd" id="1_4ra3w"]
[ext_resource type="Texture2D" uid="uid://dnu1wi2o77q83" path="res://assets/Textures/CowboyEnemy.png" id="1_7p1mj"]
[ext_resource type="Texture2D" uid="uid://bm00csi5uwmpy" path="res://assets/Textures/GunEnemy.png" id="2_md0e3"]
[ext_resource type="AudioStream" uid="uid://bxahpfo3u13ej" path="res://assets/Sfx/mask-grunt-sound-38713.mp3" id="4_5uy6h"]
[ext_resource type="AudioStream" uid="uid://mcywnc1a1hra" path="res://assets/Sfx/gun-shots-from-a-distance-5-96388.mp3" id="5_c4w8v"]
[ext_resource type="Texture2D" uid="uid://lpxchvf7lpl6" path="res://assets/Textures/ShotFlare.png" id="6_xwavj"]

[sub_resource type="CapsuleShape2D" id="CapsuleShape2D_7p1mj"]
radius = 192.0
height = 622.0

[sub_resource type="CircleShape2D" id="CircleShape2D_4ra3w"]
radius = 2486.02

[sub_resource type="CapsuleShape2D" id="CapsuleShape2D_5uy6h"]
radius = 185.0
height = 620.0

[sub_resource type="Animation" id="Animation_5uy6h"]
length = 0.001
tracks/0/type = "value"
tracks/0/imported = false
tracks/0/enabled = true
tracks/0/path = NodePath("Body:modulate")
tracks/0/interp = 1
tracks/0/loop_wrap = true
tracks/0/keys = {
"times": PackedFloat32Array(0),
"transitions": PackedFloat32Array(1),
"update": 0,
"values": [Color(1, 1, 1, 1)]
}

[sub_resource type="Animation" id="Animation_4ra3w"]
resource_name = "take_damage"
length = 0.3
tracks/0/type = "value"
tracks/0/imported = false
tracks/0/enabled = true
tracks/0/path = NodePath("Body:modulate")
tracks/0/interp = 1
tracks/0/loop_wrap = true
tracks/0/keys = {
"times": PackedFloat32Array(0, 0.3),
"transitions": PackedFloat32Array(1, 1),
"update": 0,
"values": [Color(1, 0, 0, 1), Color(1, 1, 1, 1)]
}

[sub_resource type="AnimationLibrary" id="AnimationLibrary_c4w8v"]
_data = {
&"RESET": SubResource("Animation_5uy6h"),
&"take_damage": SubResource("Animation_4ra3w")
}

[sub_resource type="Animation" id="Animation_md484"]
length = 0.001
tracks/0/type = "value"
tracks/0/imported = false
tracks/0/enabled = true
tracks/0/path = NodePath("ShotFlare:modulate")
tracks/0/interp = 1
tracks/0/loop_wrap = true
tracks/0/keys = {
"times": PackedFloat32Array(0),
"transitions": PackedFloat32Array(1),
"update": 0,
"values": [Color(1, 0.756863, 0.580392, 0)]
}

[sub_resource type="Animation" id="Animation_nenq2"]
resource_name = "enemy_gun_shot_flare"
length = 0.2
tracks/0/type = "value"
tracks/0/imported = false
tracks/0/enabled = true
tracks/0/path = NodePath("ShotFlare:modulate")
tracks/0/interp = 1
tracks/0/loop_wrap = true
tracks/0/keys = {
"times": PackedFloat32Array(0, 0.0024982, 0.2),
"transitions": PackedFloat32Array(1, 1, 1),
"update": 0,
"values": [Color(1, 0.756863, 0.580392, 0), Color(1, 0.756863, 0.580392, 1), Color(1, 0.756863, 0.580392, 0)]
}

[sub_resource type="AnimationLibrary" id="AnimationLibrary_ipns3"]
_data = {
&"RESET": SubResource("Animation_md484"),
&"enemy_gun_shot_flare": SubResource("Animation_nenq2")
}

[node name="Enemy" type="CharacterBody2D"]
scale = Vector2(0.2, 0.2)
collision_layer = 8
collision_mask = 13
script = ExtResource("1_4ra3w")

[node name="Body" type="Sprite2D" parent="."]
texture = ExtResource("1_7p1mj")

[node name="EnemyGun" type="Sprite2D" parent="Body"]
position = Vector2(350, 175)
rotation = -0.15708
texture = ExtResource("2_md0e3")

[node name="CollisionShape2D" type="CollisionShape2D" parent="."]
position = Vector2(-47, -17)
shape = SubResource("CapsuleShape2D_7p1mj")

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

[node name="CollisionShape2D" type="CollisionShape2D" parent="PlayerDetector"]
position = Vector2(-1, 0)
shape = SubResource("CircleShape2D_4ra3w")

[node name="HitBox" type="Area2D" parent="."]
collision_layer = 16

[node name="CollisionShape2D" type="CollisionShape2D" parent="HitBox"]
position = Vector2(-50, -15)
shape = SubResource("CapsuleShape2D_5uy6h")

[node name="ShootRaycast" type="RayCast2D" parent="."]
target_position = Vector2(2485, 0)
collision_mask = 3

[node name="AnimationPlayer" type="AnimationPlayer" parent="."]
libraries = {
&"": SubResource("AnimationLibrary_c4w8v")
}

[node name="HurtSound" type="AudioStreamPlayer2D" parent="."]
stream = ExtResource("4_5uy6h")
volume_db = 9.143

[node name="EnemyShotSound" type="AudioStreamPlayer2D" parent="."]
stream = ExtResource("5_c4w8v")

[node name="ShotFlare" type="Sprite2D" parent="."]
modulate = Color(1, 0.756863, 0.580392, 0)
position = Vector2(500, 150)
rotation = -0.191986
scale = Vector2(0.527778, 0.361111)
texture = ExtResource("6_xwavj")

[node name="AnimationPlayerGun" type="AnimationPlayer" parent="."]
libraries = {
&"": SubResource("AnimationLibrary_ipns3")
}

[connection signal="body_entered" from="PlayerDetector" to="." method="_on_player_detector_body_entered"]
[connection signal="body_exited" from="PlayerDetector" to="." method="_on_player_detector_body_exited"]
[connection signal="body_entered" from="HitBox" to="." method="_on_hit_box_body_entered"]
