rand bullets
This commit is contained in:
parent
55c2aeac80
commit
4ff19610d3
12 changed files with 126 additions and 56 deletions
26
systems/bullets/spawn_patterns/spawn_pattern_randomizer.gd
Normal file
26
systems/bullets/spawn_patterns/spawn_pattern_randomizer.gd
Normal file
|
|
@ -0,0 +1,26 @@
|
|||
@tool
|
||||
class_name SpawnPatternRandomizer
|
||||
extends BulletSpawnPattern
|
||||
## Randomizes properties of a child [BulletSpawnPattern] each [member iteration].
|
||||
##
|
||||
## WARNING: Experimental. Only float properties are currently
|
||||
## supported and this class is subject to change in the future.
|
||||
|
||||
|
||||
## The pattern to randomize and defer to.
|
||||
@export var pattern: BulletSpawnPattern
|
||||
|
||||
## Minimum value for each randomized property.
|
||||
@export var property_min_values: Dictionary[StringName, float] = {}
|
||||
## Maximum value for each randomized property.
|
||||
@export var property_max_values: Dictionary[StringName, float] = {}
|
||||
|
||||
|
||||
func _spawn_bullets(bullet_set: BulletSet, preset: BulletPreset) -> void:
|
||||
for property in property_min_values:
|
||||
if property_max_values.has(property):
|
||||
pattern.set(property, randf_range(
|
||||
property_min_values[property],
|
||||
property_max_values[property]
|
||||
))
|
||||
pattern.spawn_bullets(bullet_set, preset)
|
||||
Loading…
Add table
Add a link
Reference in a new issue