Time for action – sparks
When swords clash so hard that sparks fly, then you know there are heroes at work. Let's create some sparks and make them dash in random directions!
- Make a copy of
Main.java
and name the classParticle2Sparks.java
. Remember to also refactor the first line of themain()
method toParticle2Sparks app = new Particle2Sparks();
. - Copy the included file
assets/Effects/spark.png
into your project'sassets/Effect
directory. It includes a sprite animation of sparks. - In the
simpleInitApp()
method, create a spark emitter and attach it to the scene:public void simpleInitApp() { ParticleEmitter sparksEmitter = new ParticleEmitter("Spark emitter", Type.Triangle, 60); rootNode.attachChild(sparksEmitter);
- Create a material, load the spark ...
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.