Time for action – fire!

Let's have a look at a classic fire effect. You can use it in combination with a Point Light, for campfires, torches, or for a wizard's fireball spell.

  1. Make a copy of Main.java and name the class Particle6Fire.java. Remember to also refactor the first line of the main() method to Particle6Fire app = new Particle6Fire();.
  2. Copy the included file assets/Effects/flame.png into your project's assets/Effect directory. It includes a sprite animation of flames.
  3. Initialize the emitter, give it a material based on Particle.j3md, and attach it to the scene:
    public void simpleInitApp() { ParticleEmitter fireEmitter = new ParticleEmitter("Emitter", ParticleMesh.Type.Triangle, 30); Material fireMat = new Material(assetManager, "Common/MatDefs/Misc/Particle.j3md"); ...

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.