rand bullets

This commit is contained in:
Haze Weathers 2026-01-01 16:27:43 -06:00
parent 55c2aeac80
commit 4ff19610d3
12 changed files with 126 additions and 56 deletions

View file

@ -0,0 +1,34 @@
@tool
class_name RandomSpawnSetBehavior
extends BulletSetBehavior
@export var spawn_offset_min: Vector2:
set(value):
if spawn_offset_min != value:
spawn_offset_min = value
spawn_offset_max = spawn_offset_max.max(spawn_offset_min)
@export var spawn_offset_max: Vector2:
set(value):
if spawn_offset_max != value:
spawn_offset_max = value
spawn_offset_min = spawn_offset_min.min(spawn_offset_max)
@export_custom(0, "radians_as_degrees") var spawn_rotation_min: float:
set(value):
spawn_rotation_min = value
if spawn_rotation_max < spawn_rotation_min:
spawn_rotation_max = maxf(spawn_rotation_min, spawn_rotation_max)
@export_custom(0, "radians_as_degrees") var spawn_rotation_max: float:
set(value):
spawn_rotation_max = value
if spawn_rotation_min > spawn_rotation_max:
spawn_rotation_min = minf(spawn_rotation_min, spawn_rotation_max)
func _process_set(bullet_set: BulletSet, delta: float) -> void:
bullet_set.spawn_offset = Vector2(
randf_range(spawn_offset_min.x, spawn_offset_max.x),
randf_range(spawn_offset_min.y, spawn_offset_max.y)
)
bullet_set.spawn_rotation = randf_range(spawn_rotation_min, spawn_rotation_max)

View file

@ -0,0 +1 @@
uid://b02juhj57mrnj