Game Development Reference
In-Depth Information
Creating complex effects with particle
systems
A particle system is a great way to simulate complex effects such as fire, smoke,
explosions, and so on. Basically, a particle system consists of a number of images that
are rendered using either a normal (alpha masked) mode, or an additive blending
mode to create interesting results.
Take a look at the following screenshot to see the difference between normal and
additive blending modes:
LibGDX provides a sophisticated particle system through its
ParticleEffect
class.
It's merely a container that allows you to easily work with your final effects on a
high level, such as setting the position or triggering or cancelling the designed
particle effect.
The following is a brief description of the most important methods of
ParticleEffect
:
•
start()
: This starts the animation of the particle effect
•
reset()
: This resets and restarts the animation of the particle effect
•
update()
: This must be called to let the particle effect act in accordance
to time
•
draw()
: This renders the particle effect at its current position
•
allowCompletion()
: This allows emitters to stop smoothly even if particle
effects are set to play continuously