paratate/systems/bullets/spawn_patterns/ring_pattern.gd

21 lines
735 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.textures.pick_random(),
preset.hitbox_size,
Vector2.from_angle(angle + direction_rotation),
preset.face_direction
)
bullet.position = bullet_set.spawn_offset + Vector2.from_angle(angle) * distance_offset
bullet_set.add_bullet(bullet)