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; class ExplosionEffect ...

Get Haxe Game Development Essentials now with O’Reilly online learning.

O’Reilly members experience live online training, plus books, videos, and digital content from 200+ publishers.