Game Development Reference
In-Depth Information
Particle Effects
In this chapter, we will be discussing particle effects. These are the effects that are
created by utilizing particles, which are very small graphical entities. They are not
sprites and are rendered very efficiently, and you can have thousands of particles
on screen without any slowdown.
Particle effects are used for various effects that could be hard to implement otherwise.
This is why particle effects are often used to add polish and engagement to your
game. There are different kinds of effects that can be implemented by particle effects,
such as fire, explosions, rain, smoke, snow, fireworks, stars, and so on.
A particle is just a small sprite that appears on the screen for a very short amount of
time and disappears. Its speed, velocity, and other properties affect the outcome that
you will get on screen. There are hundreds and even thousands of those particles on
screen at any time particle effect is used. This is possible due to the fact that graphics
chips are optimized to show many objects with the same texture.
Particles are generated and destroyed by a special object called the particle emitter.
It knows when to make a new particle, when to kill off old particles, and the properties
of particles.
Particle emitters
Particle effects are generated by the SKEmitterNode particle emitter that generates
and manages particles. Generally, particles originate from their emitter. Each emitter
has a plethora of properties. There are more than twenty properties that affect the
emitter itself and the particles it generates.
Particle emitters are smart and they re-use particles like many other classes in
iOS ecosystem (for example UITableView and UICollectionView ). Rather than
creating a new particle every time, it re-uses particles that have gone off-screen
instead. This is one of the reasons why particle effects are so efficient.
Search WWH ::




Custom Search