class_name BulletSet extends Node2D @export var preset: BulletPreset func _ready() -> void: for _n in preset.rounds: preset.pattern.spawn_bullets(self, preset) await get_tree().create_timer(preset.round_delay, false, true).timeout func _physics_process(delta: float) -> void: for bullet in get_children(): if bullet is Bullet: preset.behavior.process_bullet(bullet, delta) else: push_error("BulletSet does not support having non-bullet children. Removing child: ", bullet) bullet.queue_free() func add_bullet(bullet: Bullet) -> void: preset.behavior.init_bullet(bullet) add_child(bullet) func add_bullets(new_bullets: Array[Bullet]) -> void: for bullet in new_bullets: preset.behavior.init_bullet(bullet) add_child(bullet)