CC3MortalPointParticle is a type of CC3PointParticle that has a finite life. More...
#import <CC3PointParticles.h>
Public Member Functions | |
(void) | - updateLife: |
Properties | |
ccTime | lifeSpan |
ccTime | timeToLive |
CC3MortalPointParticle is a type of CC3PointParticle that has a finite life.
To use particles of this type, the emitter should set the lifeSpan property of the particle to a finite time during particle initialization prior to emission.
In the update: method, particles of this type automatically keep track of the passing of time, and when the particle has passed its life span, the particle automatically expires, and sets its isAlive property is set to NO.
While the particle is alive, the update: method invokes the udpateLife: method, which subclasses should override (instead of the udpate: method itself), to update the behaviour of the particle over its lifetime.
CC3MortalPointParticles are commonly emitted by a CC3MortalPointParticleEmitter, which sets the lifeSpan to a random value with a defined range of possible lifespans. Alternately, you can create a custom CC3PointParticleEmitter subclass to set the lifeSpan property based on some other criteria.
- (void) updateLife: | (ccTime) | dt |
Invoked automatically from the udpate: method, while the particle is alive.
Subclasses should override this method to update the behaviour of the particle over its lifetime
This implementation does nothing. You do not need to invoke this superclass implementation from your overridden method implementation.
Implemented in CC3UniformMotionParticle, and CC3UniformEvolutionParticle.
- (ccTime) lifeSpan [read, write, assign] |
Indicates the overall life span of the particle.
The emitter should set this property once during initialization, prior to emission.
- (ccTime) timeToLive [read, assign] |
Indicates the remaining time the particle has to live.
This property is automatically decremented as the particle ages. Once this property reaches zero, the particle will automatically expire itself.