CCParticleSystemBase Class Reference
| Inherits from | CCNode : CCResponder : NSObject |
| Conforms to | CCBlendProtocol CCShaderProtocol CCTextureProtocol |
| Declared in | CCParticleSystemBase.h |
Overview
Felxbile particle system.
Attribute overview of a particle system
Gravity Mode (Mode A)
- Gravity
- Direction
- Speed +- variance
- Tangential acceleration +- variance
- Radial acceleration +- variance
Radius Mode (Mode B)
- Start Radius +- variance
- End Radius +- variance
- Rotate +- variance
Properties common to all modes
- 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
Supported editors
- Particle Designer http://particledesigner.71squared.com/
Notes
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)
Tasks
Accessing Particle Attributes
-
activeproperty -
particleCountproperty -
durationproperty -
sourcePositionproperty -
posVarproperty -
lifeproperty -
lifeVarproperty -
angleproperty -
angleVarproperty -
startSizeproperty -
startSizeVarproperty -
endSizeproperty -
endSizeVarproperty -
startColorproperty -
startColorVarproperty -
endColorproperty -
endColorVarproperty -
startSpinproperty -
startSpinVarproperty -
endSpinproperty -
endSpinVarproperty -
emissionRateproperty -
totalParticlesproperty -
blendAdditiveproperty -
particlePositionTypeproperty -
autoRemoveOnFinishproperty -
resetOnVisibilityToggleproperty -
emitterModeproperty
Accessing Gravity Mode Specific Attributes
-
gravityproperty -
speedproperty -
speedVarproperty -
tangentialAccelproperty -
tangentialAccelVarproperty -
radialAccelproperty -
radialAccelVarproperty
Accessing Radius Mode Specific Attributes
-
startRadiusproperty -
startRadiusVarproperty -
endRadiusproperty -
endRadiusVarproperty -
rotatePerSecondproperty -
rotatePerSecondVarproperty
Creating a CCParticleSystem Object
Initializing a CCParticleSystem Object
Particle System Management
Properties
active
True if particle system active.
@property (nonatomic, readonly) BOOL activeDeclared In
CCParticleSystemBase.hangle
Angle of each particle.
@property (nonatomic, readwrite, assign) float angleDeclared In
CCParticleSystemBase.hangleVar
Angle variance of each particle.
@property (nonatomic, readwrite, assign) float angleVarDeclared In
CCParticleSystemBase.hautoRemoveOnFinish
True will remove particle system on completition.
@property (nonatomic, readwrite) BOOL autoRemoveOnFinishDeclared In
CCParticleSystemBase.hblendAdditive
True to enable blend additive mode. (GL_SRC_ALPHA, GL_ONE).
@property (nonatomic, readwrite) BOOL blendAdditiveDeclared In
CCParticleSystemBase.hduration
How many seconds the emitter wil run. -1 means ‘forever’.
@property (nonatomic, readwrite, assign) float durationDeclared In
CCParticleSystemBase.hemissionRate
Emission rate of the particles.
@property (nonatomic, readwrite, assign) float emissionRateDeclared In
CCParticleSystemBase.hemitterMode
Set emitter mode mechanism.
@property (nonatomic, readwrite) CCParticleSystemMode emitterModeDeclared In
CCParticleSystemBase.hendColor
End color and end color variation of each particle.
@property (nonatomic, readwrite, strong) CCColor *endColorDeclared In
CCParticleSystemBase.hendColorVar
End color variance of each particle.
@property (nonatomic, readwrite, strong) CCColor *endColorVarDeclared In
CCParticleSystemBase.hendRadius
The ending radius of the particles. Only available in ‘Radius’ mode.
@property (nonatomic, readwrite, assign) float endRadiusDeclared In
CCParticleSystemBase.hendRadiusVar
The ending radius variance of the particles. Only available in ‘Radius’ mode.
@property (nonatomic, readwrite, assign) float endRadiusVarDeclared In
CCParticleSystemBase.hendSize
End size in pixels of each particle.
@property (nonatomic, readwrite, assign) float endSizeDeclared In
CCParticleSystemBase.hendSizeVar
End size variance in pixels of each particle.
@property (nonatomic, readwrite, assign) float endSizeVarDeclared In
CCParticleSystemBase.hendSpin
End spin of each particle.
@property (nonatomic, readwrite, assign) float endSpinDeclared In
CCParticleSystemBase.hendSpinVar
End spin variance of each particle.
@property (nonatomic, readwrite, assign) float endSpinVarDeclared In
CCParticleSystemBase.hgravity
Gravity value. Only available in ‘Gravity’ mode.
@property (nonatomic, readwrite, assign) CGPoint gravityDeclared In
CCParticleSystemBase.hlife
Life time of each particle.
@property (nonatomic, readwrite, assign) float lifeDeclared In
CCParticleSystemBase.hlifeVar
Life variance of each particle.
@property (nonatomic, readwrite, assign) float lifeVarDeclared In
CCParticleSystemBase.hparticleCount
Quantity of particles that are being simulated at the moment.
@property (nonatomic, readonly) NSUInteger particleCountDeclared In
CCParticleSystemBase.hparticlePositionType
Particles movement type: Free or Grouped.
@property (nonatomic, readwrite) CCParticleSystemPositionType particlePositionTypeDeclared In
CCParticleSystemBase.hposVar
The Position variance of the emitter.
@property (nonatomic, readwrite, assign) CGPoint posVarDeclared In
CCParticleSystemBase.hradialAccel
Radial acceleration of each particle. Only available in ‘Gravity’ mode.
@property (nonatomic, readwrite, assign) float radialAccelDeclared In
CCParticleSystemBase.hradialAccelVar
Radial acceleration variance of each particle. Only available in ‘Gravity’ mode.
@property (nonatomic, readwrite, assign) float radialAccelVarDeclared In
CCParticleSystemBase.hresetOnVisibilityToggle
True particle system will reset upon visibility toggling to True.
@property (nonatomic, readwrite) BOOL resetOnVisibilityToggleDeclared In
CCParticleSystemBase.hrotatePerSecond
Number of degress to rotate a particle around the source pos per second. Only available in ‘Radius’ mode.
@property (nonatomic, readwrite, assign) float rotatePerSecondDeclared In
CCParticleSystemBase.hrotatePerSecondVar
Variance in degrees for rotatePerSecond. Only available in ‘Radius’ mode.
@property (nonatomic, readwrite, assign) float rotatePerSecondVarDeclared In
CCParticleSystemBase.hsourcePosition
The source position of the emitter.
@property (nonatomic, readwrite, assign) CGPoint sourcePositionDeclared In
CCParticleSystemBase.hspeed
Speed of each particle. Only available in ‘Gravity’ mode.
@property (nonatomic, readwrite, assign) float speedDeclared In
CCParticleSystemBase.hspeedVar
Speed variance of each particle. Only available in ‘Gravity’ mode.
@property (nonatomic, readwrite, assign) float speedVarDeclared In
CCParticleSystemBase.hstartColor
Start color of each particle.
@property (nonatomic, readwrite, strong) CCColor *startColorDeclared In
CCParticleSystemBase.hstartColorVar
Start color variance of each particle.
@property (nonatomic, readwrite, strong) CCColor *startColorVarDeclared In
CCParticleSystemBase.hstartRadius
The starting radius of the particles. Only available in ‘Radius’ mode.
@property (nonatomic, readwrite, assign) float startRadiusDeclared In
CCParticleSystemBase.hstartRadiusVar
The starting radius variance of the particles. Only available in ‘Radius’ mode.
@property (nonatomic, readwrite, assign) float startRadiusVarDeclared In
CCParticleSystemBase.hstartSize
Start size in pixels of each particle.
@property (nonatomic, readwrite, assign) float startSizeDeclared In
CCParticleSystemBase.hstartSizeVar
Size variance in pixels of each particle.
@property (nonatomic, readwrite, assign) float startSizeVarDeclared In
CCParticleSystemBase.hstartSpin
Start spin of each particle.
@property (nonatomic, readwrite, assign) float startSpinDeclared In
CCParticleSystemBase.hstartSpinVar
Start spin variance of each particle.
@property (nonatomic, readwrite, assign) float startSpinVarDeclared In
CCParticleSystemBase.htangentialAccel
Tangential acceleration of each particle. Only available in ‘Gravity’ mode.
@property (nonatomic, readwrite, assign) float tangentialAccelDeclared In
CCParticleSystemBase.hClass Methods
particleWithFile:
Creates and returns a particle system object from the specified plist source file.
+ (id)particleWithFile:(NSString *)plistFileParameters
- plistFile
Particle configuration file.
Return Value
The CCParticleSystem Object.
Declared In
CCParticleSystemBase.hparticleWithTotalParticles:
Creates and returns an empty particle system object with the specified maxmium number of particles.
+ (id)particleWithTotalParticles:(NSUInteger)numberOfParticlesParameters
- numberOfParticles
Maximum particles.
Return Value
The CCParticleSystem Object.
Declared In
CCParticleSystemBase.hInstance Methods
initWithDictionary:
Initializes and returns a particle system object from the specified dictionary.
- (id)initWithDictionary:(NSDictionary *)dictionaryParameters
- dictionary
Particle dictionary object.
Return Value
An initialized CCParticleSystem Object.
Declared In
CCParticleSystemBase.hinitWithDictionary:path:
Initializes and returns a particle system object from the specified dictionary and texture directory path values.
- (id)initWithDictionary:(NSDictionary *)dictionary path:(NSString *)dirnameParameters
- dictionary
Particle dictionary object.
- dirname
Path to dictionary
Return Value
An initialized CCParticleSystem Object.
Declared In
CCParticleSystemBase.hinitWithFile:
Initializes and returns a particle system object from the specified plist source file.
- (id)initWithFile:(NSString *)plistFileParameters
- plistFile
Particle configuration file.
Return Value
An initialized CCParticleSystem Object.
Declared In
CCParticleSystemBase.hinitWithTotalParticles:
Initializes and returns an empty particle system object with the specified maxmium number of particles.
- (id)initWithTotalParticles:(NSUInteger)numberOfParticlesParameters
- numberOfParticles
Maximum particles.
Return Value
An initialized CCParticleSystem Object.
Declared In
CCParticleSystemBase.h