[gd_scene load_steps=23 format=3 uid="uid://beggmeixrin75"]

[ext_resource type="Script" uid="uid://b1b6aiai213ci" path="res://Scripts/Classes/Entities/Enemies/Pokey.gd" id="1_b54ls"]
[ext_resource type="Texture2D" uid="uid://dj46y8vhqlqjw" path="res://Assets/Sprites/Enemies/Pokey.png" id="2_8aome"]
[ext_resource type="Script" uid="uid://caq1qiwmy0mox" path="res://Scripts/Parts/BetterAnimatedSprite.gd" id="3_b54ls"]
[ext_resource type="Script" uid="uid://c3gg32ivrlq8n" path="res://Scripts/Classes/Components/GibSpawner.gd" id="4_30hxr"]
[ext_resource type="Script" uid="uid://cbal8ms2oe1ik" path="res://Scripts/Classes/Components/ResourceSetterNew.gd" id="4_bjt0v"]
[ext_resource type="JSON" path="res://Assets/Sprites/Enemies/Pokey.json" id="5_rjgwh"]
[ext_resource type="Script" uid="uid://dri2d5jtu0fbq" path="res://Scripts/Classes/Components/FireballDetection.gd" id="5_t1h12"]
[ext_resource type="Script" uid="uid://chj8hu207lrh" path="res://Scripts/Classes/Components/EnemyPlayerDetection.gd" id="6_bjt0v"]
[ext_resource type="Script" uid="uid://bbww34oiexbx2" path="res://Scripts/Classes/Components/ShellDetection.gd" id="7_rjgwh"]
[ext_resource type="Script" uid="uid://dq860i312isk" path="res://Scripts/Classes/Components/IcicleDetection.gd" id="8_1jb5g"]
[ext_resource type="Script" uid="uid://cmg61722ktg2m" path="res://Scripts/Classes/Components/BlockBouncingDetection.gd" id="9_klwvr"]
[ext_resource type="Script" uid="uid://ba18grqjixded" path="res://Scripts/Classes/Components/ExplosionDetection.gd" id="10_wuthq"]
[ext_resource type="Script" uid="uid://dlq6o2rg1x7in" path="res://Scripts/Classes/Components/BasicEnemyMovement.gd" id="11_8aome"]
[ext_resource type="Script" uid="uid://5octqlf4ohel" path="res://Scripts/Classes/Components/ScoreNoteSpawner.gd" id="12_b54ls"]
[ext_resource type="Script" uid="uid://ctfbuoxtnnl0q" path="res://Scripts/Classes/Components/EditorPropertyExposer.gd" id="13_30hxr"]
[ext_resource type="Script" uid="uid://blfnd65xcx78c" path="res://Scripts/Classes/Components/LedgeDetectionCast.gd" id="16_rjgwh"]

[sub_resource type="AtlasTexture" id="AtlasTexture_g6vo0"]
atlas = ExtResource("2_8aome")
region = Rect2(32, 0, 32, 32)

[sub_resource type="AtlasTexture" id="AtlasTexture_usxvm"]
atlas = ExtResource("2_8aome")
region = Rect2(0, 0, 32, 32)

[sub_resource type="SpriteFrames" id="SpriteFrames_86hsc"]
animations = [{
"frames": [{
"duration": 1.0,
"texture": SubResource("AtlasTexture_g6vo0")
}],
"loop": true,
"name": &"Body",
"speed": 5.0
}, {
"frames": [{
"duration": 1.0,
"texture": SubResource("AtlasTexture_usxvm")
}],
"loop": true,
"name": &"Head",
"speed": 5.0
}]

[sub_resource type="RectangleShape2D" id="RectangleShape2D_rjgwh"]
resource_local_to_scene = true
size = Vector2(12, 16)

[sub_resource type="RectangleShape2D" id="RectangleShape2D_mpg4k"]
size = Vector2(12, 12)

[sub_resource type="GDScript" id="GDScript_30hxr"]
script/source = "extends Node

func _process(delta: float) -> void:
	for i in %Parts.get_child_count():
		var node = %Parts.get_child(i)
		node.visible = i <= owner.length - 1
		node.play(\"Head\" if i == owner.length - 1 else \"Body\")
"

[node name="Pokey" type="CharacterBody2D" node_paths=PackedStringArray("on_screen_enabler", "score_note_adder") groups=["Enemies"]]
collision_layer = 16
collision_mask = 50
script = ExtResource("1_b54ls")
on_screen_enabler = NodePath("VisibleOnScreenEnabler2D")
score_note_adder = NodePath("ScoreNoteSpawner")
metadata/_custom_type_script = "uid://bpydbpyjk1mt4"

[node name="Parts" type="Node2D" parent="."]
unique_name_in_owner = true
position = Vector2(0, -8)
scale = Vector2(-1, 1)

[node name="Part1" type="AnimatedSprite2D" parent="Parts"]
sprite_frames = SubResource("SpriteFrames_86hsc")
animation = &"Body"
flip_h = true
script = ExtResource("3_b54ls")
do_offset = false
metadata/_custom_type_script = "uid://caq1qiwmy0mox"

[node name="ResourceSetterNew" type="Node" parent="Parts/Part1" node_paths=PackedStringArray("node_to_affect")]
script = ExtResource("4_bjt0v")
node_to_affect = NodePath("..")
property_name = "sprite_frames"
resource_json = ExtResource("5_rjgwh")
metadata/_custom_type_script = "uid://cbal8ms2oe1ik"

[node name="GibSpawner" type="Node" parent="Parts/Part1" node_paths=PackedStringArray("visuals")]
script = ExtResource("4_30hxr")
visuals = NodePath("..")
metadata/_custom_type_script = "uid://c3gg32ivrlq8n"

[node name="Part2" type="AnimatedSprite2D" parent="Parts"]
position = Vector2(0, -16)
sprite_frames = SubResource("SpriteFrames_86hsc")
animation = &"Body"
flip_h = true
script = ExtResource("3_b54ls")
do_offset = false
metadata/_custom_type_script = "uid://caq1qiwmy0mox"

[node name="ResourceSetterNew" type="Node" parent="Parts/Part2" node_paths=PackedStringArray("node_to_affect")]
script = ExtResource("4_bjt0v")
node_to_affect = NodePath("..")
property_name = "sprite_frames"
resource_json = ExtResource("5_rjgwh")
metadata/_custom_type_script = "uid://cbal8ms2oe1ik"

[node name="GibSpawner" type="Node" parent="Parts/Part2" node_paths=PackedStringArray("visuals")]
script = ExtResource("4_30hxr")
visuals = NodePath("..")
play_death_sfx = false
metadata/_custom_type_script = "uid://c3gg32ivrlq8n"

[node name="Part3" type="AnimatedSprite2D" parent="Parts"]
position = Vector2(0, -32)
sprite_frames = SubResource("SpriteFrames_86hsc")
animation = &"Head"
flip_h = true
script = ExtResource("3_b54ls")
do_offset = false
metadata/_custom_type_script = "uid://caq1qiwmy0mox"

[node name="ResourceSetterNew" type="Node" parent="Parts/Part3" node_paths=PackedStringArray("node_to_affect")]
script = ExtResource("4_bjt0v")
node_to_affect = NodePath("..")
property_name = "sprite_frames"
resource_json = ExtResource("5_rjgwh")
metadata/_custom_type_script = "uid://cbal8ms2oe1ik"

[node name="GibSpawner" type="Node" parent="Parts/Part3" node_paths=PackedStringArray("visuals")]
script = ExtResource("4_30hxr")
visuals = NodePath("..")
play_death_sfx = false
metadata/_custom_type_script = "uid://c3gg32ivrlq8n"

[node name="Part4" type="AnimatedSprite2D" parent="Parts"]
visible = false
position = Vector2(0, -48)
sprite_frames = SubResource("SpriteFrames_86hsc")
animation = &"Head"
flip_h = true
script = ExtResource("3_b54ls")
do_offset = false
metadata/_custom_type_script = "uid://caq1qiwmy0mox"

[node name="ResourceSetterNew" type="Node" parent="Parts/Part4" node_paths=PackedStringArray("node_to_affect")]
script = ExtResource("4_bjt0v")
node_to_affect = NodePath("..")
property_name = "sprite_frames"
resource_json = ExtResource("5_rjgwh")
metadata/_custom_type_script = "uid://cbal8ms2oe1ik"

[node name="GibSpawner" type="Node" parent="Parts/Part4" node_paths=PackedStringArray("visuals")]
script = ExtResource("4_30hxr")
visuals = NodePath("..")
play_death_sfx = false
metadata/_custom_type_script = "uid://c3gg32ivrlq8n"

[node name="Part5" type="AnimatedSprite2D" parent="Parts"]
visible = false
position = Vector2(0, -64)
sprite_frames = SubResource("SpriteFrames_86hsc")
animation = &"Head"
flip_h = true
script = ExtResource("3_b54ls")
do_offset = false
metadata/_custom_type_script = "uid://caq1qiwmy0mox"

[node name="ResourceSetterNew" type="Node" parent="Parts/Part5" node_paths=PackedStringArray("node_to_affect")]
script = ExtResource("4_bjt0v")
node_to_affect = NodePath("..")
property_name = "sprite_frames"
resource_json = ExtResource("5_rjgwh")
metadata/_custom_type_script = "uid://cbal8ms2oe1ik"

[node name="GibSpawner" type="Node" parent="Parts/Part5" node_paths=PackedStringArray("visuals")]
script = ExtResource("4_30hxr")
visuals = NodePath("..")
play_death_sfx = false
metadata/_custom_type_script = "uid://c3gg32ivrlq8n"

[node name="Part6" type="AnimatedSprite2D" parent="Parts"]
visible = false
position = Vector2(0, -80)
sprite_frames = SubResource("SpriteFrames_86hsc")
animation = &"Head"
flip_h = true
script = ExtResource("3_b54ls")
do_offset = false
metadata/_custom_type_script = "uid://caq1qiwmy0mox"

[node name="ResourceSetterNew" type="Node" parent="Parts/Part6" node_paths=PackedStringArray("node_to_affect")]
script = ExtResource("4_bjt0v")
node_to_affect = NodePath("..")
property_name = "sprite_frames"
resource_json = ExtResource("5_rjgwh")
metadata/_custom_type_script = "uid://cbal8ms2oe1ik"

[node name="GibSpawner" type="Node" parent="Parts/Part6" node_paths=PackedStringArray("visuals")]
script = ExtResource("4_30hxr")
visuals = NodePath("..")
play_death_sfx = false
metadata/_custom_type_script = "uid://c3gg32ivrlq8n"

[node name="Part7" type="AnimatedSprite2D" parent="Parts"]
visible = false
position = Vector2(0, -96)
sprite_frames = SubResource("SpriteFrames_86hsc")
animation = &"Head"
flip_h = true
script = ExtResource("3_b54ls")
do_offset = false
metadata/_custom_type_script = "uid://caq1qiwmy0mox"

[node name="ResourceSetterNew" type="Node" parent="Parts/Part7" node_paths=PackedStringArray("node_to_affect")]
script = ExtResource("4_bjt0v")
node_to_affect = NodePath("..")
property_name = "sprite_frames"
resource_json = ExtResource("5_rjgwh")
metadata/_custom_type_script = "uid://cbal8ms2oe1ik"

[node name="GibSpawner" type="Node" parent="Parts/Part7" node_paths=PackedStringArray("visuals")]
script = ExtResource("4_30hxr")
visuals = NodePath("..")
play_death_sfx = false
metadata/_custom_type_script = "uid://c3gg32ivrlq8n"

[node name="Part8" type="AnimatedSprite2D" parent="Parts"]
visible = false
position = Vector2(0, -112)
sprite_frames = SubResource("SpriteFrames_86hsc")
animation = &"Head"
flip_h = true
script = ExtResource("3_b54ls")
do_offset = false
metadata/_custom_type_script = "uid://caq1qiwmy0mox"

[node name="ResourceSetterNew" type="Node" parent="Parts/Part8" node_paths=PackedStringArray("node_to_affect")]
script = ExtResource("4_bjt0v")
node_to_affect = NodePath("..")
property_name = "sprite_frames"
resource_json = ExtResource("5_rjgwh")
metadata/_custom_type_script = "uid://cbal8ms2oe1ik"

[node name="GibSpawner" type="Node" parent="Parts/Part8" node_paths=PackedStringArray("visuals")]
script = ExtResource("4_30hxr")
visuals = NodePath("..")
play_death_sfx = false
metadata/_custom_type_script = "uid://c3gg32ivrlq8n"

[node name="Part9" type="AnimatedSprite2D" parent="Parts"]
visible = false
position = Vector2(0, -128)
sprite_frames = SubResource("SpriteFrames_86hsc")
animation = &"Head"
flip_h = true
script = ExtResource("3_b54ls")
do_offset = false
metadata/_custom_type_script = "uid://caq1qiwmy0mox"

[node name="ResourceSetterNew" type="Node" parent="Parts/Part9" node_paths=PackedStringArray("node_to_affect")]
script = ExtResource("4_bjt0v")
node_to_affect = NodePath("..")
property_name = "sprite_frames"
resource_json = ExtResource("5_rjgwh")
metadata/_custom_type_script = "uid://cbal8ms2oe1ik"

[node name="GibSpawner" type="Node" parent="Parts/Part9" node_paths=PackedStringArray("visuals")]
script = ExtResource("4_30hxr")
visuals = NodePath("..")
play_death_sfx = false
metadata/_custom_type_script = "uid://c3gg32ivrlq8n"

[node name="Part10" type="AnimatedSprite2D" parent="Parts"]
visible = false
position = Vector2(0, -144)
sprite_frames = SubResource("SpriteFrames_86hsc")
animation = &"Head"
flip_h = true
script = ExtResource("3_b54ls")
do_offset = false
metadata/_custom_type_script = "uid://caq1qiwmy0mox"

[node name="ResourceSetterNew" type="Node" parent="Parts/Part10" node_paths=PackedStringArray("node_to_affect")]
script = ExtResource("4_bjt0v")
node_to_affect = NodePath("..")
property_name = "sprite_frames"
resource_json = ExtResource("5_rjgwh")
metadata/_custom_type_script = "uid://cbal8ms2oe1ik"

[node name="GibSpawner" type="Node" parent="Parts/Part10" node_paths=PackedStringArray("visuals")]
script = ExtResource("4_30hxr")
visuals = NodePath("..")
play_death_sfx = false
metadata/_custom_type_script = "uid://c3gg32ivrlq8n"

[node name="Collision" type="CollisionShape2D" parent="."]
position = Vector2(0, -8)
shape = SubResource("RectangleShape2D_rjgwh")

[node name="FireballDetection" type="Node" parent="." node_paths=PackedStringArray("hitbox")]
script = ExtResource("5_t1h12")
hitbox = NodePath("../HeadHitbox")
play_sfx_on_hit = true
metadata/_custom_type_script = "uid://dri2d5jtu0fbq"

[node name="FireballDetection2" type="Node" parent="." node_paths=PackedStringArray("hitbox")]
script = ExtResource("5_t1h12")
hitbox = NodePath("../BodyHitbox")
play_sfx_on_hit = true
metadata/_custom_type_script = "uid://dri2d5jtu0fbq"

[node name="EnemyPlayerDetection" type="Node" parent="." node_paths=PackedStringArray("hitbox")]
script = ExtResource("6_bjt0v")
hitbox = NodePath("../BodyHitbox")
metadata/_custom_type_script = "uid://chj8hu207lrh"

[node name="ShellDetection" type="Node" parent="." node_paths=PackedStringArray("hitbox")]
script = ExtResource("7_rjgwh")
hitbox = NodePath("../BodyHitbox")
metadata/_custom_type_script = "uid://bbww34oiexbx2"

[node name="IcicleDetection" type="Node" parent="." node_paths=PackedStringArray("hitbox")]
script = ExtResource("8_1jb5g")
hitbox = NodePath("../HeadHitbox")
metadata/_custom_type_script = "uid://dq860i312isk"

[node name="BlockBouncingDetection" type="Node" parent="." node_paths=PackedStringArray("hitbox")]
script = ExtResource("9_klwvr")
detection_type = 1
hitbox = NodePath("../BodyHitbox")
metadata/_custom_type_script = "uid://cmg61722ktg2m"

[node name="ExplosionDetection" type="Node" parent="." node_paths=PackedStringArray("hitbox")]
script = ExtResource("10_wuthq")
hitbox = NodePath("../BodyHitbox")
metadata/_custom_type_script = "uid://ba18grqjixded"

[node name="BodyHitbox" type="Area2D" parent="."]
position = Vector2(0, -8)
scale = Vector2(0.9, 1)

[node name="Collision" type="CollisionShape2D" parent="BodyHitbox"]
shape = SubResource("RectangleShape2D_rjgwh")

[node name="HeadHitbox" type="Area2D" parent="."]
position = Vector2(0, -8)

[node name="CollisionShape2D" type="CollisionShape2D" parent="HeadHitbox"]
shape = SubResource("RectangleShape2D_mpg4k")

[node name="VisibleOnScreenEnabler2D" type="VisibleOnScreenEnabler2D" parent="."]
position = Vector2(0, -168)
rect = Rect2(-10, 0, 20, 176)

[node name="BasicEnemyMovement" type="Node" parent="." node_paths=PackedStringArray("ledge_detection_cast", "visuals")]
script = ExtResource("11_8aome")
ledge_detection_cast = NodePath("../LedgeDetectionCast")
move_speed = 16
second_quest_speed = 20
visuals = NodePath("../Parts")
metadata/_custom_type_script = "uid://dlq6o2rg1x7in"

[node name="ScoreNoteSpawner" type="Node" parent="."]
script = ExtResource("12_b54ls")
add_score = true
metadata/_custom_type_script = "uid://5octqlf4ohel"

[node name="EditorPropertyExposer" type="Node" parent="."]
script = ExtResource("13_30hxr")
properties = Array[String](["length"])

[node name="PartHandler" type="Node" parent="."]
process_mode = 3
script = SubResource("GDScript_30hxr")

[node name="LedgeDetectionCast" type="RayCast2D" parent="."]
position = Vector2(-4, -5)
target_position = Vector2(0, 8)
collision_mask = 2
script = ExtResource("16_rjgwh")

[connection signal="killed" from="." to="." method="summon_part_gibs" unbinds=1]
[connection signal="fireball_hit" from="FireballDetection" to="." method="die_from_object"]
[connection signal="hammer_player_hit" from="EnemyPlayerDetection" to="." method="die_from_hammer"]
[connection signal="invincible_player_hit" from="EnemyPlayerDetection" to="." method="die_from_object"]
[connection signal="player_hit" from="EnemyPlayerDetection" to="." method="damage_player"]
[connection signal="player_stomped_on" from="EnemyPlayerDetection" to="." method="damage_player"]
[connection signal="moving_shell_entered" from="ShellDetection" to="." method="die_from_object"]
[connection signal="icicle_detected" from="IcicleDetection" to="." method="die_from_object"]
[connection signal="block_bounced" from="BlockBouncingDetection" to="." method="die_from_object"]
[connection signal="explosion_entered" from="ExplosionDetection" to="." method="die_from_object"]
