Game Development Reference
In-Depth Information
You'll notice that many properties have companion properties suffixed with Var .
These are variance properties, and they determine the range of fuzziness allowed for
the corresponding property. Take, for example, the properties life = 5 and lifeVar
= 1 . These values mean that on average each particle will live for five seconds. The
variance allows a range of 5-1 to 5 + 1. So, each particle gets a random lifetime
between four to six seconds.
If you don't want any variation, set the Var variable to 0. Variation is what gives
particle effects their organic, fuzzy behavior and appearance. But variation can also be
confusing when you design a new effect, so unless you have some experience, I recom-
mend starting with a particle effect that has little or no variance.
Number of Particles
It's time for you to get acquainted with particles by starting with the total number of
particles in the particle effect, controlled by the totalParticles property. The
totalParticles variable is usually set by the initWithTotalParticles
method but can be changed later. The number of particles has a direct impact both on
the look of the effect and on performance.
-(id) init
{
return [self initWithTotalParticles:250];
}
Use too few particles and you won't get a nice glow, but it may be sufficient to sprinkle
a few stars around the player's head when he runs into a wall. Use too many particles
and it might not be what you want either, because many particles are rendered on top of
one another and possibly blended, so you basically end up with a white blob. Further-
more, using too many particles easily kills your framerate. There's a reason why the
Particle Designer tool won't let you create effects with more than 2,000 particles.
Tip In general, you should aim to achieve the desired effect with the smallest
number of particles. Particle size also plays an important roleā€”the smaller the
size of individual particles, the better the performance will be. Especially with
Search Nedrilad ::




Custom Search