Creating the explosion effects
We're going to build out the explosion effect that will play when an enemy dies. The effect will also play when an enemy makes contact with the player. The effect will comprise three parts:
- The explosion line: This is a line that will expand outward when the animation starts.
- The explosion bulb: This is a giant fireball that will swell and fade out; this is what will actually make it look like an explosion.
- Smoke particle effect: This is a puff of smoke that will linger on after the explosion.
Creating the class
We're going to make a new class named ExplosionEffect
in the source folder. The class extends the FlxGroup
object.
Here's what it should look like to start with:
package; import flixel.group.FlxGroup; class ExplosionEffect extends FlxGroup { public function new() { super(); } }
Adding imports
Now let's add the imports that we'll need:
import flixel.effects.particles.FlxEmitter; import flixel.effects.particles.FlxParticle...