Book Image

JMonkeyEngine 3.0 Cookbook

By : Rickard Eden
Book Image

JMonkeyEngine 3.0 Cookbook

By: Rickard Eden

Overview of this book

Table of Contents (17 chapters)
jMonkeyEngine 3.0 Cookbook
Credits
About the Author
About the Reviewers
www.PacktPub.com
Preface
Index

Creating a muzzle flash using ParticleEmitter


Weapons of some sort are a common feature of many games and muzzle flashes greatly enhance the appearance and feeling when you fire. This recipe will show a way to create good-looking muzzle flashes by tweaking a ParticleEmitter's properties. The following screenshot shows a texture with four muzzle flashes:

Getting ready

There are two things needed before we can begin work on the ParticleEmitter:

  • First of all we need a texture for the muzzle flash. This can have anything from one to several images of muzzle flashes. The texture should be gray scaled. We'll add color using ParticleEmitter.

  • Secondly, we need to create a Material using the texture by performing the following steps:

    1. Right-click on your project's material folder and select New.../Empty Material file.

    2. Select Particle.j3md as Material Definition.

    3. Then select the muzzle flash texture as Texture.

How to do it...

Now, we can begin creating the muzzle flash emitter:

  1. Navigate to the Emitters folder...