bullets bullets bullets bullets
This commit is contained in:
parent
846040c0e4
commit
55059788b2
25 changed files with 139 additions and 91 deletions
30
systems/bullets/bullet_actions/spawn_set_action.gd
Normal file
30
systems/bullets/bullet_actions/spawn_set_action.gd
Normal file
|
|
@ -0,0 +1,30 @@
|
|||
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:
|
||||
if match_direction:
|
||||
bullet_set.rotation = bullet.rotation
|
||||
bullet.get_parent().add_child(bullet_set)
|
||||
else:
|
||||
if match_direction:
|
||||
bullet_set.global_rotation = bullet.global_rotation
|
||||
bullet.get_parent().get_parent().add_child(bullet_set)
|
||||
Loading…
Add table
Add a link
Reference in a new issue