Time for action – fit to burst?

If you have game scenes where bullets or other projectiles hit a target, you may have thought of emphasizing the impact with a short fiery burst.

  1. Make a copy of Main.java and name the class Particle5Burst.java. Remember to also refactor the first line of the main() method to Particle5Burst app = new Particle5Burst();.
  2. Copy the included file assets/Effects/flash.png into your project's assets/Effect directory. It includes a sprite animation of a fiery burst.
  3. Since a burst is short and compact, we create an emitter with only five particles in the simpleInitApp() method:
    public void simpleInitApp() { ParticleEmitter burstEmitter = new ParticleEmitter("Burst emitter", Type.Triangle, 5); rootNode.attachChild(burstEmitter); ...

Get jMonkeyEngine 3.0 Beginner's Guide now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.