[gd_scene load_steps=18 format=3 uid="uid://byu7xm153ktle"]

[ext_resource type="Script" uid="uid://dkg8usmlrm1d3" path="res://Scripts/Classes/Entities/Enemies/Barrel.gd" id="1_dkmpo"]
[ext_resource type="Texture2D" uid="uid://t6lvjxubql7l" path="res://Assets/Sprites/Enemies/Barrel.png" id="2_dkmpo"]
[ext_resource type="Script" uid="uid://caq1qiwmy0mox" path="res://Scripts/Parts/BetterAnimatedSprite.gd" id="3_7nplu"]
[ext_resource type="Script" uid="uid://dlq6o2rg1x7in" path="res://Scripts/Classes/Components/BasicEnemyMovement.gd" id="4_8jya4"]
[ext_resource type="Script" uid="uid://cbal8ms2oe1ik" path="res://Scripts/Classes/Components/ResourceSetterNew.gd" id="4_m378g"]
[ext_resource type="Script" uid="uid://chj8hu207lrh" path="res://Scripts/Classes/Components/EnemyPlayerDetection.gd" id="4_ynq8o"]
[ext_resource type="JSON" path="res://Assets/Sprites/Enemies/Barrel.json" id="5_momh1"]
[ext_resource type="Script" uid="uid://5octqlf4ohel" path="res://Scripts/Classes/Components/ScoreNoteSpawner.gd" id="8_m378g"]
[ext_resource type="Script" uid="uid://ba18grqjixded" path="res://Scripts/Classes/Components/ExplosionDetection.gd" id="9_momh1"]
[ext_resource type="Script" uid="uid://bbww34oiexbx2" path="res://Scripts/Classes/Components/ShellDetection.gd" id="10_fyuy0"]
[ext_resource type="Script" uid="uid://cmg61722ktg2m" path="res://Scripts/Classes/Components/BlockBouncingDetection.gd" id="11_y4k56"]
[ext_resource type="Script" uid="uid://dkjpfs3sm3go3" path="res://Scripts/Classes/Components/BlockHitter.gd" id="12_d7wml"]

[sub_resource type="AtlasTexture" id="AtlasTexture_fyuy0"]
atlas = ExtResource("2_dkmpo")
region = Rect2(0, 0, 16, 16)

[sub_resource type="AtlasTexture" id="AtlasTexture_y4k56"]
atlas = ExtResource("2_dkmpo")
region = Rect2(16, 0, 16, 16)

[sub_resource type="SpriteFrames" id="SpriteFrames_d7wml"]
animations = [{
"frames": [{
"duration": 1.0,
"texture": SubResource("AtlasTexture_fyuy0")
}, {
"duration": 1.0,
"texture": SubResource("AtlasTexture_y4k56")
}],
"loop": true,
"name": &"default",
"speed": 15.0
}]

[sub_resource type="RectangleShape2D" id="RectangleShape2D_7nplu"]
size = Vector2(8, 8)

[sub_resource type="RectangleShape2D" id="RectangleShape2D_m378g"]
size = Vector2(9, 8)

[node name="Barrel" type="CharacterBody2D" node_paths=PackedStringArray("on_screen_enabler", "score_note_adder") groups=["Enemies"]]
collision_layer = 16
collision_mask = 18
floor_constant_speed = true
floor_max_angle = 1.55334
floor_snap_length = 4.0
script = ExtResource("1_dkmpo")
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, -8)
sprite_frames = SubResource("SpriteFrames_d7wml")
autoplay = "default"
frame_progress = 0.16310313
script = ExtResource("3_7nplu")
metadata/_custom_type_script = "uid://caq1qiwmy0mox"

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

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

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

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

[node name="CollisionShape2D" type="CollisionShape2D" parent="Hitbox"]
position = Vector2(-0.5, -8)
shape = SubResource("RectangleShape2D_m378g")

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

[node name="BasicEnemyMovement" type="Node" parent="."]
script = ExtResource("4_8jya4")
metadata/_custom_type_script = "uid://dlq6o2rg1x7in"

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

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

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

[node name="BlockBouncingDetection" type="Node" parent="."]
script = ExtResource("11_y4k56")
metadata/_custom_type_script = "uid://cmg61722ktg2m"

[node name="BlockHitter" type="Node" parent="." node_paths=PackedStringArray("hitbox")]
script = ExtResource("12_d7wml")
hitbox = NodePath("../Hitbox")

[connection signal="hammer_player_hit" from="EnemyPlayerDetection" to="." method="die_from_hammer"]
[connection signal="hammer_player_hit" from="EnemyPlayerDetection" to="ScoreNoteSpawner" method="spawn_note" binds= [200]]
[connection signal="invincible_player_hit" from="EnemyPlayerDetection" to="." method="destroy" unbinds=1]
[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="damage_player"]
[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="moving_shell_entered" from="ShellDetection" to="." method="die_from_object"]
[connection signal="block_bounced" from="BlockBouncingDetection" to="." method="bounce_up" unbinds=1]
