Game Development Reference
In-Depth Information
particle effects, it's important to test on older devices because they can have a
severely negative impact on performance.
Emitter Duration
The duration property determines how long particles will be emitted. If set to 2, it
will create new particles for two seconds and then stop. It's that simple:
self.duration = 2.0f;
If you'd like the particle effect node to be automatically removed from its parent node
once the particle system has stopped emitting particles and the last particles have van-
ished, set the autoRemoveOnFinish property to YES :
self.autoRemoveOnFinish = YES;
The autoRemoveOnFinish property is a convenience feature that's meaningful
only if used in conjunction with particle systems that don't run infinitely, like one-time
explosion effects. Cocos2d defines a constant kCCParticleDurationInfinity
(equals: -1) for infinitely running particle effects.
self.duration = kCCParticleDurationInfinity;
The majority of particle effects are infinitely running, and you can only stop them by
removing them from the node hierarchy. Infinitely running particle effects ignore the
autoRemoveOnFinish property.
Emitter Modes
There are two emitter modes: gravity and radius , controlled by the emitter-
Mode property. These two modes create fundamentally different effects even if most of
the parameters are the same, as you can see when you compare Figure 9-4 with Figure
9-5 . Both modes use several exclusive properties (see Listing 9-3 ) that must not be set
if they are not supported by the current mode; otherwise, you'll receive a runtime ex-
ception from cocos2d like this:
Search Nedrilad ::

Custom Search