further elaboration on bullets
This commit is contained in:
parent
da9111bcf2
commit
393c3b670a
16 changed files with 218 additions and 29 deletions
26
systems/bullets/spawn_patterns/line_pattern.gd
Normal file
26
systems/bullets/spawn_patterns/line_pattern.gd
Normal file
|
|
@ -0,0 +1,26 @@
|
|||
class_name LinePattern
|
||||
extends BulletSpawnPattern
|
||||
|
||||
|
||||
@export var bullet_count: int
|
||||
@export var line_width: float
|
||||
@export_custom(0, "direction") var line_normal: Vector2 = Vector2.RIGHT
|
||||
|
||||
|
||||
func spawn_bullets(bullet_set: BulletSet, preset: BulletPreset) -> void:
|
||||
for i in bullet_count:
|
||||
var bullet = Bullet.create(
|
||||
preset.textures.pick_random(),
|
||||
preset.hitbox_size,
|
||||
line_normal,
|
||||
preset.face_direction
|
||||
)
|
||||
|
||||
var line = line_normal.orthogonal()
|
||||
var weight = float(i) / float(bullet_count - 1)
|
||||
weight -= 0.5
|
||||
if bullet_count == 1:
|
||||
weight = 0.0
|
||||
bullet.position = line * weight * line_width
|
||||
|
||||
bullet_set.add_bullet(bullet)
|
||||
1
systems/bullets/spawn_patterns/line_pattern.gd.uid
Normal file
1
systems/bullets/spawn_patterns/line_pattern.gd.uid
Normal file
|
|
@ -0,0 +1 @@
|
|||
uid://d238qii8i2byl
|
||||
Loading…
Add table
Add a link
Reference in a new issue