Game Development Reference
In-Depth Information
Chapter 9
Particle Effects
To create special visual effects, game programmers often make use of particle systems.
Particle systems work by emitting vast numbers of tiny particles and rendering them ef-
ficiently—much more efficiently than if they were sprites. This allows you to simulate
effects such as rain, fire, snow, explosions, vapor trails, and many more.
Particle systems are driven by a great number of properties. By great I mean about 30
properties, which all influence not only the appearance and behavior of individual
particles but the whole particle effect. The particle effect is the totality of all particles
working together to create a particular visual outcome. One particle alone does not make
a fire effect; ten still don't get close enough. You would want several dozens, if not hun-
dreds, of particles to work together in just the right way to create the fire effect.
Creating convincing particle effects is a trial-and-error process. Trying all the various
properties in source code and tweaking a particle system by compiling the game, seeing
what it looks like, and then making changes and repeating this process is cumbersom to
say the least. That's where a particle design tool comes in handy, and I know just the
right one: it's called Particle Designer, and I explain how it works in this chapter.
Example Particle Effects
Cocos2d comes with a number of built-in particle effects that give you a good idea of
the kinds of effects they'll produce. You can use them as placeholders in your game or
subclass and modify the examples defined in the CCParticleExamples.m file if
you just want to apply some minor tweaks. The good thing about them is that you don't
Search Nedrilad ::




Custom Search