21 lines
681 B
GDScript
21 lines
681 B
GDScript
class_name RingPattern
|
|
extends BulletSpawnPattern
|
|
|
|
|
|
@export var bullet_count: int
|
|
@export var distance_offset: float
|
|
@export_custom(0, "radians_as_degrees") var angle_offset: float
|
|
@export_custom(0, "radians_as_degrees") var direction_rotation: float
|
|
|
|
|
|
func spawn_bullets(bullet_set: BulletSet, preset: BulletPreset) -> void:
|
|
for i in bullet_count:
|
|
var angle = (float(i) / float(bullet_count)) * TAU + angle_offset
|
|
var bullet = Bullet.create(
|
|
preset.textures.pick_random(),
|
|
preset.hitbox_size,
|
|
Vector2.from_angle(angle + direction_rotation),
|
|
preset.face_direction
|
|
)
|
|
bullet.position = Vector2.from_angle(angle) * distance_offset
|
|
bullet_set.add_bullet(bullet)
|