paratate/systems/bullets/spawn_patterns/ring_pattern.gd
2026-01-01 18:03:22 -06:00

16 lines
654 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 + bullet_set.spawn_rotation
var bullet = Bullet.create(preset, Vector2.from_angle(angle + direction_rotation))
bullet.position = bullet_set.spawn_offset + Vector2.from_angle(angle) * distance_offset
bullet_set.add_bullet(bullet)