O'Reilly logo

Haxe Game Development Essentials by Jeremy McCurdy

Stay ahead with the world's most comprehensive technology and business learning platform.

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, tutorials, and more.

Start Free Trial

No credit card required

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 ...

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, interactive tutorials, and more.

Start Free Trial

No credit card required