yes, they canjj st!
This commit is contained in:
parent
6b92473eeb
commit
a6421235f8
22 changed files with 510 additions and 14 deletions
31
systems/bullets/bullet_set.gd
Normal file
31
systems/bullets/bullet_set.gd
Normal file
|
|
@ -0,0 +1,31 @@
|
|||
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)
|
||||
Loading…
Add table
Add a link
Reference in a new issue