documentation pass before moving on

This commit is contained in:
Haze Weathers 2026-01-02 20:30:18 -06:00
parent c6923a3133
commit ddf3590c96
17 changed files with 84 additions and 44 deletions

View file

@ -1,6 +1,7 @@
@abstract
class_name BulletSpawnPattern
extends Resource
## Defines the placement of spawned bullets.
## The amount of times to spawning this pattern for one "round".
@ -9,6 +10,7 @@ extends Resource
@export_range(1, 1, 1, "or_greater") var iterations: int = 1
## Creates and adds bullets to the passed [BulletSet].
func spawn_bullets(bullet_set: BulletSet, preset: BulletPreset) -> void:
for _n in iterations:
_spawn_bullets(bullet_set, preset)

View file

@ -1,15 +1,19 @@
class_name LinePattern
extends BulletSpawnPattern
## Spawns bullets evenly spaced out along a line segment.
## Number of bullets to spawn along the line.
@export var bullet_count: int
## Distance between the first and last bullet in the line.
@export var line_width: float
## The direction that spawned bullets will travel, orthogonal to the line of bullets.
@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, line_normal)
var bullet = Bullet.create(preset, line_normal.rotated(bullet_set.spawn_rotation))
var line = line_normal.orthogonal().rotated(bullet_set.spawn_rotation)
var weight = float(i) / float(bullet_count - 1)

View file

@ -1,10 +1,15 @@
class_name RingPattern
extends BulletSpawnPattern
## Spawns bullets evenly spaced out around a circle.
@export var bullet_count: int
@export var distance_offset: float
## The number of bullets to spawn along the circle.
@export var bullet_count: int = 3
## Radius of the circle that bullets spawn along the edge of.
@export var radius: float
## Rotation of the entire ring pattern.
@export_custom(0, "radians_as_degrees") var angle_offset: float
## Rotation of each bullet's travel direction.
@export_custom(0, "radians_as_degrees") var direction_rotation: float
@ -12,5 +17,5 @@ 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.position = bullet_set.spawn_offset + Vector2.from_angle(angle) * radius
bullet_set.add_bullet(bullet)