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/actions/spawn_set_action.gd
Normal file
26
systems/bullets/actions/spawn_set_action.gd
Normal file
|
|
@ -0,0 +1,26 @@
|
|||
class_name SpawnSetAction
|
||||
extends BulletAction
|
||||
## Spawns a new [BulletSet] at the [Bullet]'s position when triggered.
|
||||
|
||||
|
||||
## The [BulletPreset] to use for the spawned [BulletSet].
|
||||
@export var preset: BulletPreset
|
||||
|
||||
## If [code]true[/code], the spawned [BulletSet] will be rotated to face the
|
||||
## [Bullet]'s direction.
|
||||
@export var match_direction: bool = false
|
||||
|
||||
## If [code]true[/code], the spawned [BulletSet] will be added as a child of
|
||||
## the [Bullet]'s parent [BulletSet]. If [code]false[/code], it will be added
|
||||
## as a child of that [BulletSet]'s parent [Node].
|
||||
@export var local_coords: bool = false
|
||||
|
||||
|
||||
func _perform(bullet: Bullet) -> void:
|
||||
var bullet_set = BulletSet.new()
|
||||
bullet_set.preset = preset
|
||||
bullet_set.global_position = bullet.global_position
|
||||
if local_coords:
|
||||
bullet.get_parent().add_child(bullet_set)
|
||||
else:
|
||||
bullet.get_parent().get_parent().add_child(bullet_set)
|
||||
Loading…
Add table
Add a link
Reference in a new issue