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.
Make a copy of
Main.java
and name the classParticle5Burst.java
. Remember to also refactor the first line of themain()
method toParticle5Burst app = new Particle5Burst();
.Copy the included file
assets/Effects/flash.png
into your project'sassets/Effect
directory. It includes a sprite animation of a fiery burst.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);
The
flash.png
sprite animation contains a random series of 2 x 2 explosive flashes. Set both animation dimensions to2
, and the image order torandom
:Material burstMat = new Material(assetManager, "Common/MatDefs/Misc/Particle.j3md"); burstMat...