Inherits from CCNode : NSObject
Conforms to CCTextureProtocol
Declared in CCParticleSystem.h

Overview

Particle System base class Attributes of a Particle System:

- emmision rate of the particles
- Gravity Mode (Mode A):
    - gravity
    - direction
    - speed +-  variance
    - tangential acceleration +- variance
    - radial acceleration +- variance
- Radius Mode (Mode B):
    - startRadius +- variance
    - endRadius +- variance
    - rotate +- variance
- Properties common to all modes:
    - life +- life variance
    - start spin +- variance
    - end spin +- variance
    - start size +- variance
    - end size +- variance
    - start color +- variance
    - end color +- variance
    - life +- variance
    - blending function
- texture

cocos2d also supports particles generated by Particle Designer (http://particledesigner.71squared.com/). ‘Radius Mode’ in Particle Designer uses a fixed emit rate of 30 hz. Since that can’t be guarateed in cocos2d, cocos2d uses a another approach, but the results are almost identical.

cocos2d supports all the variables used by Particle Designer plus a bit more:

- spinning particles (supported when using CCParticleSystemQuad)
- tangential acceleration (Gravity mode)
- radial acceleration (Gravity mode)
- radius direction (Radius mode) (Particle Designer supports outwards to inwards direction only)

It is possible to customize any of the above mentioned properties in runtime. Example:

@code

emitter.radialAccel = 15;
emitter.startSpin = 0;

@endcode

Tasks

Other Methods

Other Methods

Properties

active

Is the emitter active

@property (nonatomic, readonly) BOOL active

Declared In

CCParticleSystem.h

angle

angle and angle variation of each particle

@property (nonatomic, readwrite, assign) float angle

Declared In

CCParticleSystem.h

angleVar

angle variance of each particle

@property (nonatomic, readwrite, assign) float angleVar

Declared In

CCParticleSystem.h

atlasIndex

autoRemoveOnFinish

whether or not the node will be auto-removed when it has no particles left. By default it is NO.

@property (nonatomic, readwrite) BOOL autoRemoveOnFinish

Availability

Declared In

CCParticleSystem.h

batchNode

weak reference to the CCSpriteBatchNode that renders the CCSprite

@property (nonatomic, readwrite, assign) CCParticleBatchNode *batchNode

Declared In

CCParticleSystem.h

blendAdditive

whether or not the particles are using blend additive. If enabled, the following blending function will be used. @code

source blend function = GL_SRC_ALPHA;
dest blend function = GL_ONE;

@endcode

@property (nonatomic, readwrite) BOOL blendAdditive

Declared In

CCParticleSystem.h

blendFunc

conforms to CocosNodeTexture protocol

@property (nonatomic, readwrite) ccBlendFunc blendFunc

Declared In

CCParticleSystem.h

centerOfGravity

centerOfGravity of the emitter

@property (nonatomic, readwrite, assign) CGPoint centerOfGravity

Declared In

CCParticleSystem.h

duration

How many seconds the emitter wil run. -1 means ‘forever’

@property (nonatomic, readwrite, assign) float duration

Declared In

CCParticleSystem.h

emissionRate

emission rate of the particles

@property (nonatomic, readwrite, assign) float emissionRate

Declared In

CCParticleSystem.h

emitterMode

Switch between different kind of emitter modes: – kCCParticleModeGravity: uses gravity, speed, radial and tangential acceleration – kCCParticleModeRadius: uses radius movement + rotation

@property (nonatomic, readwrite) NSInteger emitterMode

Declared In

CCParticleSystem.h

endColor

end color and end color variation of each particle

@property (nonatomic, readwrite, assign) ccColor4F endColor

Declared In

CCParticleSystem.h

endColorVar

end color variance of each particle

@property (nonatomic, readwrite, assign) ccColor4F endColorVar

Declared In

CCParticleSystem.h

endRadius

The ending radius of the particles. Only available in ‘Radius’ mode.

@property (nonatomic, readwrite, assign) float endRadius

Declared In

CCParticleSystem.h

endRadiusVar

The ending radius variance of the particles. Only available in ‘Radius’ mode.

@property (nonatomic, readwrite, assign) float endRadiusVar

Declared In

CCParticleSystem.h

endSize

end size in pixels of each particle

@property (nonatomic, readwrite, assign) float endSize

Declared In

CCParticleSystem.h

endSizeVar

end size variance in pixels of each particle

@property (nonatomic, readwrite, assign) float endSizeVar

Declared In

CCParticleSystem.h

endSpin

endSpinVar

gravity

Gravity value. Only available in ‘Gravity’ mode.

@property (nonatomic, readwrite, assign) CGPoint gravity

Declared In

CCParticleSystem.h

life

life, and life variation of each particle

@property (nonatomic, readwrite, assign) float life

Declared In

CCParticleSystem.h

lifeVar

life variance of each particle

@property (nonatomic, readwrite, assign) float lifeVar

Declared In

CCParticleSystem.h

opacityModifyRGB

does the alpha value modify color

@property (nonatomic, readwrite, getter=doesOpacityModifyRGB, assign) BOOL opacityModifyRGB

Declared In

CCParticleSystem.h

particleCount

Quantity of particles that are being simulated at the moment

@property (nonatomic, readonly) NSUInteger particleCount

Declared In

CCParticleSystem.h

posVar

Position variance of the emitter

@property (nonatomic, readwrite, assign) CGPoint posVar

Declared In

CCParticleSystem.h

positionType

particles movement type: Free or Grouped

@property (nonatomic, readwrite) tCCPositionType positionType

Availability

Declared In

CCParticleSystem.h

radialAccel

radial acceleration of each particle. Only available in ‘Gravity’ mode.

@property (nonatomic, readwrite, assign) float radialAccel

Declared In

CCParticleSystem.h

radialAccelVar

radial acceleration variance of each particle. Only available in ‘Gravity’ mode.

@property (nonatomic, readwrite, assign) float radialAccelVar

Declared In

CCParticleSystem.h

rotatePerSecond

Number of degress to rotate a particle around the source pos per second. Only available in ‘Radius’ mode.

@property (nonatomic, readwrite, assign) float rotatePerSecond

Declared In

CCParticleSystem.h

rotatePerSecondVar

Variance in degrees for rotatePerSecond. Only available in ‘Radius’ mode.

@property (nonatomic, readwrite, assign) float rotatePerSecondVar

Declared In

CCParticleSystem.h

sourcePosition

sourcePosition of the emitter

@property (nonatomic, readwrite, assign) CGPoint sourcePosition

Declared In

CCParticleSystem.h

speed

speed of each particle. Only available in ‘Gravity’ mode.

@property (nonatomic, readwrite, assign) float speed

Declared In

CCParticleSystem.h

speedVar

speed variance of each particle. Only available in ‘Gravity’ mode.

@property (nonatomic, readwrite, assign) float speedVar

Declared In

CCParticleSystem.h

startColor

start color of each particle

@property (nonatomic, readwrite, assign) ccColor4F startColor

Declared In

CCParticleSystem.h

startColorVar

start color variance of each particle

@property (nonatomic, readwrite, assign) ccColor4F startColorVar

Declared In

CCParticleSystem.h

startRadius

The starting radius of the particles. Only available in ‘Radius’ mode.

@property (nonatomic, readwrite, assign) float startRadius

Declared In

CCParticleSystem.h

startRadiusVar

The starting radius variance of the particles. Only available in ‘Radius’ mode.

@property (nonatomic, readwrite, assign) float startRadiusVar

Declared In

CCParticleSystem.h

startSize

start size in pixels of each particle

@property (nonatomic, readwrite, assign) float startSize

Declared In

CCParticleSystem.h

startSizeVar

size variance in pixels of each particle

@property (nonatomic, readwrite, assign) float startSizeVar

Declared In

CCParticleSystem.h

startSpin

startSpinVar

tangentialAccel

tangential acceleration of each particle. Only available in ‘Gravity’ mode.

@property (nonatomic, readwrite, assign) float tangentialAccel

Declared In

CCParticleSystem.h

tangentialAccelVar

tangential acceleration variance of each particle. Only available in ‘Gravity’ mode.

@property (nonatomic, readwrite, assign) float tangentialAccelVar

Declared In

CCParticleSystem.h

texture

conforms to CocosNodeTexture protocol

@property (nonatomic, readwrite, retain) CCTexture2D *texture

Declared In

CCParticleSystem.h

totalParticles

maximum particles of the system

@property (nonatomic, readwrite, assign) NSUInteger totalParticles

Declared In

CCParticleSystem.h

Class Methods

particleWithFile:

creates an initializes a CCParticleSystem from a plist file. This plist files can be creted manually or with Particle Designer:

http://particledesigner.71squared.com/
+ (id)particleWithFile:(NSString *)plistFile

Availability

Declared In

CCParticleSystem.h

particleWithTotalParticles:

Instance Methods

addParticle

initParticle:

initWithDictionary:

initializes a particle system from a NSDictionary.

- (id)initWithDictionary:(NSDictionary *)dictionary

Availability

Declared In

CCParticleSystem.h

initWithDictionary:path:

initializes a particle system from a NSDictionary and the path from where to load the png

- (id)initWithDictionary:(NSDictionary *)dictionary path:(NSString *)dirname

Availability

Declared In

CCParticleSystem.h

initWithFile:

initializes a CCParticleSystem from a plist file. This plist files can be creted manually or with Particle Designer:

http://particledesigner.71squared.com/
- (id)initWithFile:(NSString *)plistFile

Availability

Declared In

CCParticleSystem.h

initWithTotalParticles:

isFull

postStep

resetSystem

stopSystem

update:

updateQuadWithParticle:newPosition:

updateWithNoTime