[gd_scene load_steps=16 format=3 uid="uid://iq86u4w60yee"]

[ext_resource type="Texture2D" uid="uid://b7n5kp30whnb3" path="res://Assets/Sprites/Blocks/FireBar.png" id="1_e2e05"]
[ext_resource type="Script" uid="uid://caq1qiwmy0mox" path="res://Scripts/Parts/BetterAnimatedSprite.gd" id="2_kpo86"]
[ext_resource type="Script" uid="uid://cbal8ms2oe1ik" path="res://Scripts/Classes/Components/ResourceSetterNew.gd" id="3_kpo86"]
[ext_resource type="Script" uid="uid://ctfbuoxtnnl0q" path="res://Scripts/Classes/Components/EditorPropertyExposer.gd" id="3_p4n6u"]
[ext_resource type="Script" uid="uid://cpwloakvp672a" path="res://Scripts/Parts/EditorVisibleNode.gd" id="4_vag0n"]
[ext_resource type="JSON" path="res://Assets/Sprites/Enemies/FireBarFireBall.json" id="4_ym371"]
[ext_resource type="Texture2D" uid="uid://dsncqqhfsnq6s" path="res://Assets/Sprites/Editor/RotationIcon.png" id="5_ytedt"]
[ext_resource type="Script" uid="uid://cq6f682453q6o" path="res://Scripts/Classes/Components/ResourceSetter.gd" id="6_m0plg"]
[ext_resource type="Resource" uid="uid://c8ojbqg4q4qh6" path="res://Resources/ThemedResources/EditorRotationIcon.tres" id="7_3irkc"]

[sub_resource type="GDScript" id="GDScript_e2e05"]
script/source = "extends Node2D

@export_range(4, 16) var length := 6

@export_range(0, 360, 45) var starting_angle := 0

@export_enum(\"C-Clockwise\", \"Clockwise\") var direction := 0

func _physics_process(delta: float) -> void:
	$RotationJoint.global_rotation_degrees += 90 * delta * [-1, 1][direction]

func on_area_entered(area: Area2D) -> void:
	if area.owner is Player:
		area.owner.damage()
"

[sub_resource type="SegmentShape2D" id="SegmentShape2D_p4n6u"]
resource_local_to_scene = true
b = Vector2(0, -40)

[sub_resource type="Animation" id="Animation_vag0n"]
length = 0.001
tracks/0/type = "value"
tracks/0/imported = false
tracks/0/enabled = true
tracks/0/path = NodePath(".:rotation")
tracks/0/interp = 1
tracks/0/loop_wrap = true
tracks/0/keys = {
"times": PackedFloat32Array(0),
"transitions": PackedFloat32Array(1),
"update": 0,
"values": [0.0]
}

[sub_resource type="Animation" id="Animation_oygiu"]
resource_name = "Spin"
length = 0.4
loop_mode = 1
step = 0.1
tracks/0/type = "value"
tracks/0/imported = false
tracks/0/enabled = true
tracks/0/path = NodePath(".:rotation")
tracks/0/interp = 0
tracks/0/loop_wrap = true
tracks/0/keys = {
"times": PackedFloat32Array(0, 0.100442, 0.2, 0.3),
"transitions": PackedFloat32Array(1, 1, 1, 1),
"update": 0,
"values": [0.0, 1.5708, 3.14159, 4.71239]
}

[sub_resource type="AnimationLibrary" id="AnimationLibrary_ytedt"]
_data = {
&"RESET": SubResource("Animation_vag0n"),
&"Spin": SubResource("Animation_oygiu")
}

[sub_resource type="GDScript" id="GDScript_p4n6u"]
script/source = "@tool
extends Node

func _ready() -> void:
	await get_tree().physics_frame
	%RotationJoint.global_rotation_degrees = owner.starting_angle

func _process(_delta: float) -> void:
	var idx := 0
	for i in $\"../Fireballs\".get_children():
		i.visible = idx < owner.length
		idx += 1
	if Engine.is_editor_hint() == false:
		if Global.current_game_mode == Global.GameMode.LEVEL_EDITOR and LevelEditor.playing_level == false:
			%RotationJoint.global_rotation_degrees = owner.starting_angle
	else:
		%RotationJoint.global_rotation_degrees = owner.starting_angle
	$\"../RotationJoint/Hitbox/Shape\".shape.b = Vector2(0, -(owner.length - 1) * 8)
	$\"../Node2D/Sprite2D\".scale.x = [-1, 1][owner.direction]
"

[node name="Firebar" type="Node2D"]
script = SubResource("GDScript_e2e05")

[node name="FireBar" type="Sprite2D" parent="."]
visible = false
top_level = true
z_index = -5
texture = ExtResource("1_e2e05")

[node name="RotationJoint" type="Node2D" parent="."]
unique_name_in_owner = true
z_index = 20

[node name="RemoteTransform2D" type="RemoteTransform2D" parent="RotationJoint"]
remote_path = NodePath("../../Fireballs/Fireball1")
update_rotation = false
update_scale = false

[node name="RemoteTransform2D2" type="RemoteTransform2D" parent="RotationJoint"]
position = Vector2(0, -8)
remote_path = NodePath("../../Fireballs/Fireball2")
update_rotation = false
update_scale = false

[node name="RemoteTransform2D3" type="RemoteTransform2D" parent="RotationJoint"]
position = Vector2(0, -16)
remote_path = NodePath("../../Fireballs/Fireball3")
update_rotation = false
update_scale = false

[node name="RemoteTransform2D4" type="RemoteTransform2D" parent="RotationJoint"]
position = Vector2(0, -24)
remote_path = NodePath("../../Fireballs/Fireball4")
update_rotation = false
update_scale = false

[node name="RemoteTransform2D5" type="RemoteTransform2D" parent="RotationJoint"]
position = Vector2(0, -32)
remote_path = NodePath("../../Fireballs/Fireball5")
update_rotation = false
update_scale = false

[node name="RemoteTransform2D6" type="RemoteTransform2D" parent="RotationJoint"]
position = Vector2(0, -40)
remote_path = NodePath("../../Fireballs/Fireball6")
update_rotation = false
update_scale = false

[node name="RemoteTransform2D7" type="RemoteTransform2D" parent="RotationJoint"]
position = Vector2(0, -48)
remote_path = NodePath("../../Fireballs/Fireball7")
update_rotation = false
update_scale = false

[node name="RemoteTransform2D8" type="RemoteTransform2D" parent="RotationJoint"]
position = Vector2(0, -56)
remote_path = NodePath("../../Fireballs/Fireball8")
update_rotation = false
update_scale = false

[node name="RemoteTransform2D9" type="RemoteTransform2D" parent="RotationJoint"]
position = Vector2(0, -64)
remote_path = NodePath("../../Fireballs/Fireball9")
update_rotation = false
update_scale = false

[node name="RemoteTransform2D10" type="RemoteTransform2D" parent="RotationJoint"]
position = Vector2(0, -72)
remote_path = NodePath("../../Fireballs/Fireball10")
update_rotation = false
update_scale = false

[node name="RemoteTransform2D11" type="RemoteTransform2D" parent="RotationJoint"]
position = Vector2(0, -80)
remote_path = NodePath("../../Fireballs/Fireball11")
update_rotation = false
update_scale = false

[node name="RemoteTransform2D12" type="RemoteTransform2D" parent="RotationJoint"]
position = Vector2(0, -88)
remote_path = NodePath("../../Fireballs/Fireball12")
update_rotation = false
update_scale = false

[node name="RemoteTransform2D13" type="RemoteTransform2D" parent="RotationJoint"]
position = Vector2(0, -96)
remote_path = NodePath("../../Fireballs/Fireball13")
update_rotation = false
update_scale = false

[node name="RemoteTransform2D14" type="RemoteTransform2D" parent="RotationJoint"]
position = Vector2(0, -104)
remote_path = NodePath("../../Fireballs/Fireball14")
update_rotation = false
update_scale = false

[node name="RemoteTransform2D15" type="RemoteTransform2D" parent="RotationJoint"]
position = Vector2(0, -112)
remote_path = NodePath("../../Fireballs/Fireball15")
update_rotation = false
update_scale = false

[node name="RemoteTransform2D16" type="RemoteTransform2D" parent="RotationJoint"]
position = Vector2(0, -120)
remote_path = NodePath("../../Fireballs/Fireball16")
update_rotation = false
update_scale = false

[node name="Hitbox" type="Area2D" parent="RotationJoint"]

[node name="Shape" type="CollisionShape2D" parent="RotationJoint/Hitbox"]
shape = SubResource("SegmentShape2D_p4n6u")

[node name="Fireballs" type="Node2D" parent="."]
unique_name_in_owner = true
z_index = 20

[node name="Fireball1" type="AnimatedSprite2D" parent="Fireballs"]
script = ExtResource("2_kpo86")
do_offset = false
metadata/_custom_type_script = "uid://caq1qiwmy0mox"

[node name="Animation" type="AnimationPlayer" parent="Fireballs/Fireball1"]
libraries = {
&"": SubResource("AnimationLibrary_ytedt")
}
autoplay = "Spin"

[node name="ResourceSetter" type="Node" parent="Fireballs/Fireball1" node_paths=PackedStringArray("node_to_affect")]
script = ExtResource("3_kpo86")
node_to_affect = NodePath("..")
property_name = "sprite_frames"
resource_json = ExtResource("4_ym371")
metadata/_custom_type_script = "uid://cbal8ms2oe1ik"

[node name="Fireball2" type="AnimatedSprite2D" parent="Fireballs"]
position = Vector2(0, -8)
script = ExtResource("2_kpo86")
do_offset = false
metadata/_custom_type_script = "uid://caq1qiwmy0mox"

[node name="Animation" type="AnimationPlayer" parent="Fireballs/Fireball2"]
libraries = {
&"": SubResource("AnimationLibrary_ytedt")
}
autoplay = "Spin"

[node name="ResourceSetter" type="Node" parent="Fireballs/Fireball2" node_paths=PackedStringArray("node_to_affect")]
script = ExtResource("3_kpo86")
node_to_affect = NodePath("..")
property_name = "sprite_frames"
resource_json = ExtResource("4_ym371")
metadata/_custom_type_script = "uid://cbal8ms2oe1ik"

[node name="Fireball3" type="AnimatedSprite2D" parent="Fireballs"]
position = Vector2(0, -16)
script = ExtResource("2_kpo86")
do_offset = false
metadata/_custom_type_script = "uid://caq1qiwmy0mox"

[node name="Animation" type="AnimationPlayer" parent="Fireballs/Fireball3"]
libraries = {
&"": SubResource("AnimationLibrary_ytedt")
}
autoplay = "Spin"

[node name="ResourceSetter" type="Node" parent="Fireballs/Fireball3" node_paths=PackedStringArray("node_to_affect")]
script = ExtResource("3_kpo86")
node_to_affect = NodePath("..")
property_name = "sprite_frames"
resource_json = ExtResource("4_ym371")
metadata/_custom_type_script = "uid://cbal8ms2oe1ik"

[node name="Fireball4" type="AnimatedSprite2D" parent="Fireballs"]
position = Vector2(0, -24)
script = ExtResource("2_kpo86")
do_offset = false
metadata/_custom_type_script = "uid://caq1qiwmy0mox"

[node name="Animation" type="AnimationPlayer" parent="Fireballs/Fireball4"]
libraries = {
&"": SubResource("AnimationLibrary_ytedt")
}
autoplay = "Spin"

[node name="ResourceSetter" type="Node" parent="Fireballs/Fireball4" node_paths=PackedStringArray("node_to_affect")]
script = ExtResource("3_kpo86")
node_to_affect = NodePath("..")
property_name = "sprite_frames"
resource_json = ExtResource("4_ym371")
metadata/_custom_type_script = "uid://cbal8ms2oe1ik"

[node name="Fireball5" type="AnimatedSprite2D" parent="Fireballs"]
position = Vector2(0, -32)
script = ExtResource("2_kpo86")
do_offset = false
metadata/_custom_type_script = "uid://caq1qiwmy0mox"

[node name="Animation" type="AnimationPlayer" parent="Fireballs/Fireball5"]
libraries = {
&"": SubResource("AnimationLibrary_ytedt")
}
autoplay = "Spin"

[node name="ResourceSetter" type="Node" parent="Fireballs/Fireball5" node_paths=PackedStringArray("node_to_affect")]
script = ExtResource("3_kpo86")
node_to_affect = NodePath("..")
property_name = "sprite_frames"
resource_json = ExtResource("4_ym371")
metadata/_custom_type_script = "uid://cbal8ms2oe1ik"

[node name="Fireball6" type="AnimatedSprite2D" parent="Fireballs"]
position = Vector2(0, -40)
script = ExtResource("2_kpo86")
do_offset = false
metadata/_custom_type_script = "uid://caq1qiwmy0mox"

[node name="Animation" type="AnimationPlayer" parent="Fireballs/Fireball6"]
libraries = {
&"": SubResource("AnimationLibrary_ytedt")
}
autoplay = "Spin"

[node name="ResourceSetter" type="Node" parent="Fireballs/Fireball6" node_paths=PackedStringArray("node_to_affect")]
script = ExtResource("3_kpo86")
node_to_affect = NodePath("..")
property_name = "sprite_frames"
resource_json = ExtResource("4_ym371")
metadata/_custom_type_script = "uid://cbal8ms2oe1ik"

[node name="Fireball7" type="AnimatedSprite2D" parent="Fireballs"]
visible = false
position = Vector2(0, -48)
script = ExtResource("2_kpo86")
do_offset = false
metadata/_custom_type_script = "uid://caq1qiwmy0mox"

[node name="Animation" type="AnimationPlayer" parent="Fireballs/Fireball7"]
libraries = {
&"": SubResource("AnimationLibrary_ytedt")
}
autoplay = "Spin"

[node name="ResourceSetter" type="Node" parent="Fireballs/Fireball7" node_paths=PackedStringArray("node_to_affect")]
script = ExtResource("3_kpo86")
node_to_affect = NodePath("..")
property_name = "sprite_frames"
resource_json = ExtResource("4_ym371")
metadata/_custom_type_script = "uid://cbal8ms2oe1ik"

[node name="Fireball8" type="AnimatedSprite2D" parent="Fireballs"]
visible = false
position = Vector2(0, -56)
script = ExtResource("2_kpo86")
do_offset = false
metadata/_custom_type_script = "uid://caq1qiwmy0mox"

[node name="Animation" type="AnimationPlayer" parent="Fireballs/Fireball8"]
libraries = {
&"": SubResource("AnimationLibrary_ytedt")
}
autoplay = "Spin"

[node name="ResourceSetter" type="Node" parent="Fireballs/Fireball8" node_paths=PackedStringArray("node_to_affect")]
script = ExtResource("3_kpo86")
node_to_affect = NodePath("..")
property_name = "sprite_frames"
resource_json = ExtResource("4_ym371")
metadata/_custom_type_script = "uid://cbal8ms2oe1ik"

[node name="Fireball9" type="AnimatedSprite2D" parent="Fireballs"]
visible = false
position = Vector2(0, -64)
script = ExtResource("2_kpo86")
do_offset = false
metadata/_custom_type_script = "uid://caq1qiwmy0mox"

[node name="Animation" type="AnimationPlayer" parent="Fireballs/Fireball9"]
libraries = {
&"": SubResource("AnimationLibrary_ytedt")
}
autoplay = "Spin"

[node name="ResourceSetter" type="Node" parent="Fireballs/Fireball9" node_paths=PackedStringArray("node_to_affect")]
script = ExtResource("3_kpo86")
node_to_affect = NodePath("..")
property_name = "sprite_frames"
resource_json = ExtResource("4_ym371")
metadata/_custom_type_script = "uid://cbal8ms2oe1ik"

[node name="Fireball10" type="AnimatedSprite2D" parent="Fireballs"]
visible = false
position = Vector2(0, -72)
script = ExtResource("2_kpo86")
do_offset = false
metadata/_custom_type_script = "uid://caq1qiwmy0mox"

[node name="Animation" type="AnimationPlayer" parent="Fireballs/Fireball10"]
libraries = {
&"": SubResource("AnimationLibrary_ytedt")
}
autoplay = "Spin"

[node name="ResourceSetter" type="Node" parent="Fireballs/Fireball10" node_paths=PackedStringArray("node_to_affect")]
script = ExtResource("3_kpo86")
node_to_affect = NodePath("..")
property_name = "sprite_frames"
resource_json = ExtResource("4_ym371")
metadata/_custom_type_script = "uid://cbal8ms2oe1ik"

[node name="Fireball11" type="AnimatedSprite2D" parent="Fireballs"]
visible = false
position = Vector2(0, -80)
script = ExtResource("2_kpo86")
do_offset = false
metadata/_custom_type_script = "uid://caq1qiwmy0mox"

[node name="Animation" type="AnimationPlayer" parent="Fireballs/Fireball11"]
libraries = {
&"": SubResource("AnimationLibrary_ytedt")
}
autoplay = "Spin"

[node name="ResourceSetter" type="Node" parent="Fireballs/Fireball11" node_paths=PackedStringArray("node_to_affect")]
script = ExtResource("3_kpo86")
node_to_affect = NodePath("..")
property_name = "sprite_frames"
resource_json = ExtResource("4_ym371")
metadata/_custom_type_script = "uid://cbal8ms2oe1ik"

[node name="Fireball12" type="AnimatedSprite2D" parent="Fireballs"]
visible = false
position = Vector2(0, -88)
script = ExtResource("2_kpo86")
do_offset = false
metadata/_custom_type_script = "uid://caq1qiwmy0mox"

[node name="Animation" type="AnimationPlayer" parent="Fireballs/Fireball12"]
libraries = {
&"": SubResource("AnimationLibrary_ytedt")
}
autoplay = "Spin"

[node name="ResourceSetter" type="Node" parent="Fireballs/Fireball12" node_paths=PackedStringArray("node_to_affect")]
script = ExtResource("3_kpo86")
node_to_affect = NodePath("..")
property_name = "sprite_frames"
resource_json = ExtResource("4_ym371")
metadata/_custom_type_script = "uid://cbal8ms2oe1ik"

[node name="Fireball13" type="AnimatedSprite2D" parent="Fireballs"]
visible = false
position = Vector2(0, -96)
script = ExtResource("2_kpo86")
do_offset = false
metadata/_custom_type_script = "uid://caq1qiwmy0mox"

[node name="Animation" type="AnimationPlayer" parent="Fireballs/Fireball13"]
libraries = {
&"": SubResource("AnimationLibrary_ytedt")
}
autoplay = "Spin"

[node name="ResourceSetter" type="Node" parent="Fireballs/Fireball13" node_paths=PackedStringArray("node_to_affect")]
script = ExtResource("3_kpo86")
node_to_affect = NodePath("..")
property_name = "sprite_frames"
resource_json = ExtResource("4_ym371")
metadata/_custom_type_script = "uid://cbal8ms2oe1ik"

[node name="Fireball14" type="AnimatedSprite2D" parent="Fireballs"]
visible = false
position = Vector2(0, -104)
script = ExtResource("2_kpo86")
do_offset = false
metadata/_custom_type_script = "uid://caq1qiwmy0mox"

[node name="Animation" type="AnimationPlayer" parent="Fireballs/Fireball14"]
libraries = {
&"": SubResource("AnimationLibrary_ytedt")
}
autoplay = "Spin"

[node name="ResourceSetter" type="Node" parent="Fireballs/Fireball14" node_paths=PackedStringArray("node_to_affect")]
script = ExtResource("3_kpo86")
node_to_affect = NodePath("..")
property_name = "sprite_frames"
resource_json = ExtResource("4_ym371")
metadata/_custom_type_script = "uid://cbal8ms2oe1ik"

[node name="Fireball15" type="AnimatedSprite2D" parent="Fireballs"]
visible = false
position = Vector2(0, -112)
script = ExtResource("2_kpo86")
do_offset = false
metadata/_custom_type_script = "uid://caq1qiwmy0mox"

[node name="Animation" type="AnimationPlayer" parent="Fireballs/Fireball15"]
libraries = {
&"": SubResource("AnimationLibrary_ytedt")
}
autoplay = "Spin"

[node name="ResourceSetter" type="Node" parent="Fireballs/Fireball15" node_paths=PackedStringArray("node_to_affect")]
script = ExtResource("3_kpo86")
node_to_affect = NodePath("..")
property_name = "sprite_frames"
resource_json = ExtResource("4_ym371")
metadata/_custom_type_script = "uid://cbal8ms2oe1ik"

[node name="Fireball16" type="AnimatedSprite2D" parent="Fireballs"]
visible = false
position = Vector2(0, -120)
script = ExtResource("2_kpo86")
do_offset = false
metadata/_custom_type_script = "uid://caq1qiwmy0mox"

[node name="Animation" type="AnimationPlayer" parent="Fireballs/Fireball16"]
libraries = {
&"": SubResource("AnimationLibrary_ytedt")
}
autoplay = "Spin"

[node name="ResourceSetter" type="Node" parent="Fireballs/Fireball16" node_paths=PackedStringArray("node_to_affect")]
script = ExtResource("3_kpo86")
node_to_affect = NodePath("..")
property_name = "sprite_frames"
resource_json = ExtResource("4_ym371")
metadata/_custom_type_script = "uid://cbal8ms2oe1ik"

[node name="RemoteTransform2D" type="RemoteTransform2D" parent="."]
remote_path = NodePath("../FireBar")
update_rotation = false
update_scale = false

[node name="EditorPropertyExposer" type="Node" parent="."]
script = ExtResource("3_p4n6u")
properties = Array[String](["length", "starting_angle", "direction"])

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

[node name="Node2D" type="Node2D" parent="."]
script = ExtResource("4_vag0n")

[node name="Sprite2D" type="Sprite2D" parent="Node2D"]
physics_interpolation_mode = 2
z_index = 50
z_as_relative = false
scale = Vector2(-1, 1)
texture = ExtResource("5_ytedt")
offset = Vector2(1, 0)

[node name="ResourceSetter" type="Node" parent="Node2D/Sprite2D" node_paths=PackedStringArray("node_to_affect")]
script = ExtResource("6_m0plg")
node_to_affect = NodePath("..")
property_name = "texture"
themed_resource = ExtResource("7_3irkc")
metadata/_custom_type_script = "uid://cq6f682453q6o"

[connection signal="area_entered" from="RotationJoint/Hitbox" to="." method="on_area_entered"]
