[gd_scene load_steps=25 format=3 uid="uid://r6dlmokkdyar"]

[ext_resource type="Script" uid="uid://q8gx0l64pcjh" path="res://Scripts/Classes/Entities/Enemies/KoopaTroopa.gd" id="1_ykjo1"]
[ext_resource type="Texture2D" uid="uid://cy6v7tdtxebs5" path="res://Assets/Sprites/Enemies/KoopaTroopa.png" id="2_ykjo1"]
[ext_resource type="Script" uid="uid://caq1qiwmy0mox" path="res://Scripts/Parts/BetterAnimatedSprite.gd" id="3_2rsfy"]
[ext_resource type="Script" uid="uid://chj8hu207lrh" path="res://Scripts/Classes/Components/EnemyPlayerDetection.gd" id="4_1sj6f"]
[ext_resource type="Script" uid="uid://cbal8ms2oe1ik" path="res://Scripts/Classes/Components/ResourceSetterNew.gd" id="4_71l08"]
[ext_resource type="Script" uid="uid://dri2d5jtu0fbq" path="res://Scripts/Classes/Components/FireballDetection.gd" id="5_8y4pd"]
[ext_resource type="JSON" path="res://Assets/Sprites/Enemies/GreenKoopaTroopa.json" id="5_mook0"]
[ext_resource type="JSON" path="res://Assets/Sprites/Enemies/GreenKoopaShell.json" id="6_71l08"]
[ext_resource type="Script" uid="uid://c3gg32ivrlq8n" path="res://Scripts/Classes/Components/GibSpawner.gd" id="6_fop3r"]
[ext_resource type="PackedScene" uid="uid://bupy7th8ln45c" path="res://Scenes/Parts/Wing.tscn" id="6_gkyfa"]
[ext_resource type="Script" uid="uid://cmg61722ktg2m" path="res://Scripts/Classes/Components/BlockBouncingDetection.gd" id="7_fop3r"]
[ext_resource type="Script" uid="uid://blfnd65xcx78c" path="res://Scripts/Classes/Components/LedgeDetectionCast.gd" id="8_gkyfa"]
[ext_resource type="Script" uid="uid://bbww34oiexbx2" path="res://Scripts/Classes/Components/ShellDetection.gd" id="8_y8bq4"]
[ext_resource type="Script" uid="uid://5octqlf4ohel" path="res://Scripts/Classes/Components/ScoreNoteSpawner.gd" id="9_gf50m"]
[ext_resource type="Script" uid="uid://dq860i312isk" path="res://Scripts/Classes/Components/IcicleDetection.gd" id="12_iydhw"]
[ext_resource type="Script" uid="uid://dlq6o2rg1x7in" path="res://Scripts/Classes/Components/BasicEnemyMovement.gd" id="15_71l08"]
[ext_resource type="Script" uid="uid://ba18grqjixded" path="res://Scripts/Classes/Components/ExplosionDetection.gd" id="16_dgip2"]
[ext_resource type="Script" uid="uid://d4a7yp6e55u8t" path="res://Scripts/Classes/Components/TrackJoint.gd" id="18_rldwo"]
[ext_resource type="Script" uid="uid://maqpreddu5kg" path="res://Scripts/Classes/Components/LevelPersistance.gd" id="19_j14in"]

[sub_resource type="AtlasTexture" id="AtlasTexture_71l08"]
atlas = ExtResource("2_ykjo1")
region = Rect2(0, 0, 16, 32)

[sub_resource type="AtlasTexture" id="AtlasTexture_dgip2"]
atlas = ExtResource("2_ykjo1")
region = Rect2(16, 0, 16, 32)

[sub_resource type="SpriteFrames" id="SpriteFrames_anxyg"]
animations = [{
"frames": [{
"duration": 1.0,
"texture": SubResource("AtlasTexture_71l08")
}, {
"duration": 1.0,
"texture": SubResource("AtlasTexture_dgip2")
}],
"loop": true,
"name": &"Walk",
"speed": 5.0
}]

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

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

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

[node name="Sprite" type="AnimatedSprite2D" parent="."]
position = Vector2(0, -16)
scale = Vector2(-1, 1)
sprite_frames = SubResource("SpriteFrames_anxyg")
animation = &"Walk"
autoplay = "Walk"
offset = Vector2(0, 1)
flip_h = true
script = ExtResource("3_2rsfy")
metadata/_custom_type_script = "uid://caq1qiwmy0mox"

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

[node name="Wing" parent="Sprite" instance=ExtResource("6_gkyfa")]
unique_name_in_owner = true
visible = false
position = Vector2(-8, 3)
autoplay = "Flap"
frame_progress = 0.0
flip_h = true

[node name="DeathSprite" type="AnimatedSprite2D" parent="."]
visible = false
position = Vector2(0, -8)
script = ExtResource("3_2rsfy")
metadata/_custom_type_script = "uid://caq1qiwmy0mox"

[node name="ResourceSetterNew" type="Node" parent="DeathSprite" node_paths=PackedStringArray("node_to_affect")]
script = ExtResource("4_71l08")
node_to_affect = NodePath("..")
property_name = "sprite_frames"
resource_json = ExtResource("6_71l08")
metadata/_custom_type_script = "uid://cbal8ms2oe1ik"

[node name="Collision" type="CollisionShape2D" parent="."]
visible = false
position = Vector2(0, -6)
rotation = 1.5708
shape = SubResource("RectangleShape2D_fop3r")
one_way_collision = true

[node name="Collision2" type="CollisionShape2D" parent="."]
visible = false
position = Vector2(0, -6)
rotation = -1.5708
shape = SubResource("RectangleShape2D_fop3r")
one_way_collision = true

[node name="Hitbox" type="Area2D" parent="."]
collision_mask = 7

[node name="Shape" type="CollisionShape2D" parent="Hitbox"]
position = Vector2(0, -5.5)
shape = SubResource("RectangleShape2D_y8bq4")

[node name="LedgeDetectionCast" type="RayCast2D" parent="."]
position = Vector2(-8, -2)
target_position = Vector2(0, 3)
collision_mask = 2
script = ExtResource("8_gkyfa")
metadata/_custom_type_script = "uid://blfnd65xcx78c"

[node name="VisibleOnScreenEnabler2D" type="VisibleOnScreenEnabler2D" parent="."]
self_modulate = Color(1, 1, 1, 0)
position = Vector2(0, -11)
scale = Vector2(1, 1.3)

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

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

[node name="GibSpawner" type="Node" parent="." node_paths=PackedStringArray("visuals")]
script = ExtResource("6_fop3r")
visuals = NodePath("../DeathSprite")
metadata/_custom_type_script = "uid://c3gg32ivrlq8n"

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

[node name="ShellDetection" type="Node" parent="." node_paths=PackedStringArray("hitbox")]
script = ExtResource("8_y8bq4")
hitbox = NodePath("../Hitbox")

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

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

[node name="BasicEnemyMovement" type="Node" parent="."]
script = ExtResource("15_71l08")
auto_call = false

[node name="ExplosionDetection" type="Node" parent="." node_paths=PackedStringArray("hitbox")]
script = ExtResource("16_dgip2")
hitbox = NodePath("../Hitbox")

[node name="TrackJoint" type="Node" parent="." node_paths=PackedStringArray("movement_node")]
script = ExtResource("18_rldwo")
movement_node = NodePath("../BasicEnemyMovement")
metadata/_custom_type_script = "uid://d4a7yp6e55u8t"

[node name="LevelPersistance" type="Node" parent="."]
script = ExtResource("19_j14in")
metadata/_custom_type_script = "uid://maqpreddu5kg"

[connection signal="killed" from="." to="GibSpawner" method="summon_gib"]
[connection signal="killed" from="." to="LevelPersistance" method="set_as_active" unbinds=1]
[connection signal="invincible_player_hit" from="EnemyPlayerDetection" to="." method="die_from_object"]
[connection signal="invincible_player_hit" from="EnemyPlayerDetection" to="ScoreNoteSpawner" method="spawn_note" binds= [200]]
[connection signal="player_hit" from="EnemyPlayerDetection" to="." method="damage_player"]
[connection signal="player_stomped_on" from="EnemyPlayerDetection" to="." method="stomped_on"]
[connection signal="player_stomped_on" from="EnemyPlayerDetection" to="LevelPersistance" method="set_as_active" unbinds=1]
[connection signal="fireball_hit" from="FireballDetection" to="." method="die_from_object"]
[connection signal="fireball_hit" from="FireballDetection" to="ScoreNoteSpawner" method="spawn_note" binds= [200]]
[connection signal="block_bounced" from="BlockBouncingDetection" to="ScoreNoteSpawner" method="spawn_note" binds= [200]]
[connection signal="block_bounced" from="BlockBouncingDetection" to="." method="block_bounced" unbinds=1]
[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="explosion_entered" from="ExplosionDetection" to="." method="die_from_object"]
[connection signal="explosion_entered" from="ExplosionDetection" to="ScoreNoteSpawner" method="spawn_note" binds= [200]]
[connection signal="enabled" from="LevelPersistance" to="." method="queue_free"]
