[gd_scene load_steps=15 format=3 uid="uid://bv38ynjkpisyk"]

[ext_resource type="Script" uid="uid://dbu4juvw4veul" path="res://Scripts/Classes/Blocks/DonutBlock.gd" id="1_asdop"]
[ext_resource type="Texture2D" uid="uid://s2miqaqyk4bm" path="res://Assets/Sprites/Blocks/DonutBlock.png" id="1_ydbi0"]
[ext_resource type="Script" uid="uid://cnheej0sxmoxg" path="res://Scripts/Parts/PlayerDetection.gd" id="2_asdop"]
[ext_resource type="Script" uid="uid://cbal8ms2oe1ik" path="res://Scripts/Classes/Components/ResourceSetterNew.gd" id="3_3jqqs"]
[ext_resource type="JSON" path="res://Assets/Sprites/Blocks/DonutBlock.json" id="4_woaa1"]

[sub_resource type="RectangleShape2D" id="RectangleShape2D_skbwb"]
size = Vector2(16, 16)

[sub_resource type="AtlasTexture" id="AtlasTexture_3jqqs"]
atlas = ExtResource("1_ydbi0")
region = Rect2(16, 0, 16, 16)

[sub_resource type="AtlasTexture" id="AtlasTexture_woaa1"]
atlas = ExtResource("1_ydbi0")
region = Rect2(0, 0, 16, 16)

[sub_resource type="SpriteFrames" id="SpriteFrames_6bmau"]
animations = [{
"frames": [{
"duration": 1.0,
"texture": SubResource("AtlasTexture_3jqqs")
}],
"loop": true,
"name": &"Fall",
"speed": 5.0
}, {
"frames": [{
"duration": 1.0,
"texture": SubResource("AtlasTexture_woaa1")
}],
"loop": true,
"name": &"Idle",
"speed": 5.0
}]

[sub_resource type="Animation" id="Animation_633oe"]
resource_name = "Grow"
length = 0.5
tracks/0/type = "value"
tracks/0/imported = false
tracks/0/enabled = true
tracks/0/path = NodePath("Sprite:offset")
tracks/0/interp = 1
tracks/0/loop_wrap = true
tracks/0/keys = {
"times": PackedFloat32Array(0),
"transitions": PackedFloat32Array(1),
"update": 0,
"values": [Vector2(0, 0)]
}
tracks/1/type = "value"
tracks/1/imported = false
tracks/1/enabled = true
tracks/1/path = NodePath("Sprite:scale")
tracks/1/interp = 2
tracks/1/loop_wrap = true
tracks/1/keys = {
"times": PackedFloat32Array(0, 0.5),
"transitions": PackedFloat32Array(1, 1),
"update": 0,
"values": [Vector2(0, 0), Vector2(1, 1)]
}

[sub_resource type="Animation" id="Animation_vf85a"]
length = 0.001
tracks/0/type = "value"
tracks/0/imported = false
tracks/0/enabled = true
tracks/0/path = NodePath("Sprite:offset")
tracks/0/interp = 1
tracks/0/loop_wrap = true
tracks/0/keys = {
"times": PackedFloat32Array(0),
"transitions": PackedFloat32Array(1),
"update": 0,
"values": [Vector2(0, 0)]
}
tracks/1/type = "value"
tracks/1/imported = false
tracks/1/enabled = true
tracks/1/path = NodePath("Sprite:scale")
tracks/1/interp = 1
tracks/1/loop_wrap = true
tracks/1/keys = {
"times": PackedFloat32Array(0),
"transitions": PackedFloat32Array(1),
"update": 0,
"values": [Vector2(1, 1)]
}

[sub_resource type="Animation" id="Animation_aq712"]
resource_name = "Shake"
tracks/0/type = "value"
tracks/0/imported = false
tracks/0/enabled = true
tracks/0/path = NodePath("Sprite:offset")
tracks/0/interp = 2
tracks/0/loop_wrap = true
tracks/0/keys = {
"times": PackedFloat32Array(0, 0.1, 0.2),
"transitions": PackedFloat32Array(1, 1, 1),
"update": 0,
"values": [Vector2(-1, 0), Vector2(1, 0), Vector2(0, 0)]
}
tracks/1/type = "method"
tracks/1/imported = false
tracks/1/enabled = true
tracks/1/path = NodePath(".")
tracks/1/interp = 1
tracks/1/loop_wrap = true
tracks/1/keys = {
"times": PackedFloat32Array(1),
"transitions": PackedFloat32Array(1),
"values": [{
"args": [],
"method": &"start_falling"
}]
}

[sub_resource type="AnimationLibrary" id="AnimationLibrary_srhyq"]
_data = {
&"Grow": SubResource("Animation_633oe"),
&"RESET": SubResource("Animation_vf85a"),
&"Shake": SubResource("Animation_aq712")
}

[sub_resource type="RectangleShape2D" id="RectangleShape2D_obema"]
size = Vector2(15, 2)

[node name="DonutBlock" type="StaticBody2D"]
collision_layer = 6
collision_mask = 0
script = ExtResource("1_asdop")

[node name="Collision" type="CollisionShape2D" parent="."]
shape = SubResource("RectangleShape2D_skbwb")

[node name="Sprite" type="AnimatedSprite2D" parent="."]
sprite_frames = SubResource("SpriteFrames_6bmau")
animation = &"Idle"
autoplay = "Idle"
frame_progress = 0.0124768

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

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

[node name="PlayerDetection" type="Area2D" parent="."]
script = ExtResource("2_asdop")
metadata/_custom_type_script = "uid://cnheej0sxmoxg"

[node name="CollisionShape2D" type="CollisionShape2D" parent="PlayerDetection"]
position = Vector2(0, -9)
shape = SubResource("RectangleShape2D_obema")

[node name="FallTimer" type="Timer" parent="."]
wait_time = 5.0
one_shot = true

[connection signal="player_entered" from="PlayerDetection" to="." method="on_player_entered" unbinds=1]
[connection signal="player_exited" from="PlayerDetection" to="." method="on_player_exited" unbinds=1]
[connection signal="timeout" from="FallTimer" to="." method="respawn"]
