[gd_scene load_steps=20 format=3 uid="uid://ciddq8ctlj453"]

[ext_resource type="Script" uid="uid://df20kjawaoqcl" path="res://Scripts/Classes/Entities/Objects/PSwitch.gd" id="1_v4mdn"]
[ext_resource type="Texture2D" uid="uid://y81rhybgt7kb" path="res://Assets/Sprites/Items/PSwitch.png" id="1_x602l"]
[ext_resource type="Script" uid="uid://caq1qiwmy0mox" path="res://Scripts/Parts/BetterAnimatedSprite.gd" id="2_6jgcs"]
[ext_resource type="Script" uid="uid://cnheej0sxmoxg" path="res://Scripts/Parts/PlayerDetection.gd" id="3_05vv4"]
[ext_resource type="Script" uid="uid://cbal8ms2oe1ik" path="res://Scripts/Classes/Components/ResourceSetterNew.gd" id="3_mnfbm"]
[ext_resource type="JSON" path="res://Assets/Sprites/Items/PSwitch.json" id="4_1w7q1"]
[ext_resource type="Script" uid="uid://bx6r8sjar6cwr" path="res://Scripts/Classes/Components/BasicStaticMovement.gd" id="4_6jgcs"]
[ext_resource type="Script" uid="uid://c3gg32ivrlq8n" path="res://Scripts/Classes/Components/GibSpawner.gd" id="7_1w7q1"]

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

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

[sub_resource type="AtlasTexture" id="AtlasTexture_v4mdn"]
atlas = ExtResource("1_x602l")
region = Rect2(32, 0, 16, 16)

[sub_resource type="AtlasTexture" id="AtlasTexture_i4nd2"]
atlas = ExtResource("1_x602l")
region = Rect2(48, 0, 16, 16)

[sub_resource type="SpriteFrames" id="SpriteFrames_eeyhw"]
animations = [{
"frames": [{
"duration": 10.0,
"texture": SubResource("AtlasTexture_mnfbm")
}, {
"duration": 1.0,
"texture": SubResource("AtlasTexture_1w7q1")
}, {
"duration": 1.0,
"texture": SubResource("AtlasTexture_v4mdn")
}, {
"duration": 1.0,
"texture": SubResource("AtlasTexture_1w7q1")
}],
"loop": true,
"name": &"Idle",
"speed": 10.0
}, {
"frames": [{
"duration": 1.0,
"texture": SubResource("AtlasTexture_i4nd2")
}],
"loop": true,
"name": &"Pressed",
"speed": 5.0
}]

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

[sub_resource type="RectangleShape2D" id="RectangleShape2D_ofd0i"]
size = Vector2(10, 2)

[sub_resource type="Animation" id="Animation_v4mdn"]
resource_name = "Pressed"
length = 0.5
tracks/0/type = "value"
tracks/0/imported = false
tracks/0/enabled = true
tracks/0/path = NodePath("PressedCollision:shape:size")
tracks/0/interp = 1
tracks/0/loop_wrap = true
tracks/0/keys = {
"times": PackedFloat32Array(0),
"transitions": PackedFloat32Array(1),
"update": 0,
"values": [Vector2(12, 5)]
}
tracks/1/type = "value"
tracks/1/imported = false
tracks/1/enabled = true
tracks/1/path = NodePath("PressedCollision:position")
tracks/1/interp = 1
tracks/1/loop_wrap = true
tracks/1/keys = {
"times": PackedFloat32Array(0),
"transitions": PackedFloat32Array(1),
"update": 0,
"values": [Vector2(0, -2.5)]
}
tracks/2/type = "method"
tracks/2/imported = false
tracks/2/enabled = true
tracks/2/path = NodePath(".")
tracks/2/interp = 1
tracks/2/loop_wrap = true
tracks/2/keys = {
"times": PackedFloat32Array(0.5),
"transitions": PackedFloat32Array(1),
"values": [{
"args": [],
"method": &"queue_free"
}]
}
tracks/3/type = "method"
tracks/3/imported = false
tracks/3/enabled = true
tracks/3/path = NodePath("GibSpawner")
tracks/3/interp = 1
tracks/3/loop_wrap = true
tracks/3/keys = {
"times": PackedFloat32Array(0.5),
"transitions": PackedFloat32Array(1),
"values": [{
"args": [],
"method": &"summon_poof"
}]
}
tracks/4/type = "method"
tracks/4/imported = false
tracks/4/enabled = true
tracks/4/path = NodePath("LCollision")
tracks/4/interp = 1
tracks/4/loop_wrap = true
tracks/4/keys = {
"times": PackedFloat32Array(0),
"transitions": PackedFloat32Array(1),
"values": [{
"args": [],
"method": &"queue_free"
}]
}
tracks/5/type = "method"
tracks/5/imported = false
tracks/5/enabled = true
tracks/5/path = NodePath("RCollision")
tracks/5/interp = 1
tracks/5/loop_wrap = true
tracks/5/keys = {
"times": PackedFloat32Array(0),
"transitions": PackedFloat32Array(1),
"values": [{
"args": [],
"method": &"queue_free"
}]
}

[sub_resource type="Animation" id="Animation_i4nd2"]
length = 0.001

[sub_resource type="AnimationLibrary" id="AnimationLibrary_eeyhw"]
_data = {
&"Pressed": SubResource("Animation_v4mdn"),
&"RESET": SubResource("Animation_i4nd2")
}

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

[node name="PSwitch" type="CharacterBody2D"]
collision_layer = 33
collision_mask = 6
script = ExtResource("1_v4mdn")

[node name="Sprite" type="AnimatedSprite2D" parent="."]
position = Vector2(0, -8)
sprite_frames = SubResource("SpriteFrames_eeyhw")
animation = &"Idle"
autoplay = "Idle"
offset = Vector2(0, 1)
script = ExtResource("2_6jgcs")
metadata/_custom_type_script = "uid://caq1qiwmy0mox"

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

[node name="PressedCollision" type="CollisionShape2D" parent="."]
position = Vector2(0, -2.5)
shape = SubResource("RectangleShape2D_12hsl")
one_way_collision = true

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

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

[node name="BasicStaticMovement" type="Node" parent="." node_paths=PackedStringArray("visuals")]
script = ExtResource("4_6jgcs")
visuals = NodePath("../Sprite")
metadata/_custom_type_script = "uid://bx6r8sjar6cwr"

[node name="GibSpawner" type="Node" parent="." node_paths=PackedStringArray("visuals")]
script = ExtResource("7_1w7q1")
visuals = NodePath("../Sprite")
gib_type = 2
play_death_sfx = false
metadata/_custom_type_script = "uid://c3gg32ivrlq8n"

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

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

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

[connection signal="player_entered" from="PlayerDetection" to="." method="on_player_entered"]
