rand bullets
This commit is contained in:
parent
55c2aeac80
commit
4ff19610d3
12 changed files with 126 additions and 56 deletions
34
systems/bullets/set_behaviors/random_spawn_set_behavior.gd
Normal file
34
systems/bullets/set_behaviors/random_spawn_set_behavior.gd
Normal 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)
|
||||
|
|
@ -0,0 +1 @@
|
|||
uid://b02juhj57mrnj
|
||||
Loading…
Add table
Add a link
Reference in a new issue