Now we have all of the individual effects working, we’re going to finally chain them together and make the complete explosion.
Add a new AnimationPlayer to the scene. We’ll use animations to precisely tweak the time each particle is emitted without having to work with code.
From the Animation interface, create a new “Animation” and name it “Explode” by clicking on the Animation button.
Toggle the “Autoplay” button on the right to play this animation as soon as our Explosion enters the scene. This is useful if you’re going to instance this effect in run time.
Change the animation duration to the total length of our explosion. This is equal to the highest Lifetime in our particles. The particles that take the longest to completely disappear are the SmokeCloudParticles2D with a Lifetime of 3.0
seconds so we’ll use this as our animation length.
Let’s decrease the Snap to 0.05
so we can fine tune our animation. This allows us to set keyframes in intervals of 0.05
seconds.
Select the FireBurstParticles2D and in the Inspector toggle the Emitting property on. Since we’re in the animation context, notice there are key icons shown on the right side of properties. Click on the key icon next to the Emitting property to add a new track and key for this property. Do the same for the other particles.
Let’s make sure the particles emit only once for the explosion duration. Since they all have a Lifetime greater than or equal to 0.5
, we’re going to use this time to stop their emission.
Move the animation cursor position in the timeline to 0.5
. Select all the keys and duplicated them with CTRL+D. Select all the new keys and toggle the Emitting checkbox to make them all false.
The explosion already looks good if you play the animation but we can improve it.
Notice how all the fire trails emit at the same time. This doesn’t feel isn’t natural so let’s emit them at different times. We’ll do so near the beginning of the explosion since this is when the scraps would shoot out due to explosive forces.
For each FireTrailParticles2D track, select both keys and move them slightly to the right at different positions in the timeline.
With that we complete our Explosion!
If you want the explosion to automatically free itself when it finishes, you can add a Call Method Track in at the very end of the animation which calls the Explosion queue_free()
method.
We can add a new WorldEnvironment in the final scene where the explosion will be used and toggle on the Glow post-process just like we did with the Laser Beam effect.
In our Explosion we can increase the Modulation of the effect that we want to glow by using the ColorPicker in RAW mode to bump the modulation.