Hey,
just wanted to know how you handle triggering multiple particle effects + sound for your game when an effect needs more than 1 single particle system.
I do it in the following way (but I'm not sure if there's maybe a better solution?
So, I've made an FX-Scene per effect where a Node2D is a root and several AudioStreamPlayers and ParticleSystems can be a child. A script at the root iterates over all children and starts each on _ready()::
Node2D (+ Script)
- AudioStreamPlayer_explosion
- CpuParticle2D_explosion_1
- CpuParticle2D_shockwave_2
- CpuParticle2D_sparkles_3
The function to start all particle systems is for example:
func get_particle_systems():
for child in get_children():
if child.is_class("CPUParticles2D"):
child.emitting = true
Since Particle Systems don't free themselves, my script also checks if any particle system is still emitting or if any sound is still playing. If not, it kills the whole thing:
func _process(_delta):
if started:
var isAnyoneStillEmitting = false
for particle in particleSystems:
if particle.emitting:
isAnyoneStillEmitting = true
for child in get_children():
if child.is_class("AudioStreamPlayer2D"):
if child.playing:
isAnyoneStillEmitting = true
if not isAnyoneStillEmitting:
queue_free()
I just want to know: Are you doing it like me (starting and also killing the particle systems/sounds)? Is there maybe a better solution?