[gd_scene load_steps=9 format=3 uid="uid://bumvqjhs2xxka"]

[ext_resource type="Script" uid="uid://bfdtqldkrv4dn" path="res://Scripts/Classes/Entities/Enemies/CannonBall.gd" id="1_yim3j"]
[ext_resource type="Script" uid="uid://cnheej0sxmoxg" path="res://Scripts/Parts/PlayerDetection.gd" id="2_il73j"]
[ext_resource type="Script" uid="uid://cbal8ms2oe1ik" path="res://Scripts/Classes/Components/ResourceSetterNew.gd" id="2_yim3j"]
[ext_resource type="JSON" path="res://Assets/Sprites/Enemies/CannonBall.json" id="3_874xq"]
[ext_resource type="Script" uid="uid://chj8hu207lrh" path="res://Scripts/Classes/Components/EnemyPlayerDetection.gd" id="3_pydrn"]
[ext_resource type="Script" uid="uid://c3gg32ivrlq8n" path="res://Scripts/Classes/Components/GibSpawner.gd" id="4_yim3j"]
[ext_resource type="Script" uid="uid://5octqlf4ohel" path="res://Scripts/Classes/Components/ScoreNoteSpawner.gd" id="5_il73j"]

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

[node name="CannonBall" type="CharacterBody2D" node_paths=PackedStringArray("on_screen_enabler", "score_note_adder")]
z_index = -1
script = ExtResource("1_yim3j")
on_screen_enabler = NodePath("VisibleOnScreenEnabler2D")
score_note_adder = NodePath("ScoreNoteSpawner")
metadata/_custom_type_script = "uid://bpydbpyjk1mt4"

[node name="Sprite" type="Sprite2D" parent="."]

[node name="ResourceSetterNew" type="Node" parent="Sprite" node_paths=PackedStringArray("node_to_affect")]
script = ExtResource("2_yim3j")
node_to_affect = NodePath("..")
property_name = "texture"
mode = 1
resource_json = ExtResource("3_874xq")
metadata/_custom_type_script = "uid://cbal8ms2oe1ik"

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

[node name="CollisionShape2D" type="CollisionShape2D" parent="PlayerDetection"]
shape = SubResource("RectangleShape2D_yim3j")

[node name="EnemyPlayerDetection" type="Node" parent="." node_paths=PackedStringArray("hitbox")]
script = ExtResource("3_pydrn")
hitbox = NodePath("../PlayerDetection")
height = 0
metadata/_custom_type_script = "uid://chj8hu207lrh"

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

[node name="VisibleOnScreenEnabler2D" type="VisibleOnScreenEnabler2D" parent="."]

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

[connection signal="invincible_player_hit" from="EnemyPlayerDetection" to="." method="die_from_object"]
[connection signal="player_hit" from="EnemyPlayerDetection" to="." method="damage_player"]
[connection signal="player_stomped_on" from="EnemyPlayerDetection" to="GibSpawner" method="stomp_die"]
[connection signal="gib_about_to_spawn" from="GibSpawner" to="Sprite" method="set_flip_v" binds= [true]]
[connection signal="screen_exited" from="VisibleOnScreenEnabler2D" to="." method="queue_free"]
