Public Member Functions | Static Public Member Functions | Properties

CCParticleSystem Class Reference

#import <CCParticleSystem.h>

Inherits CCNode, and CCTextureProtocol-p.

Inherited by CCPointParticleSystem, and CCQuadParticleSystem.

Collaboration diagram for CCParticleSystem:
Collaboration graph
[legend]

List of all members.

Public Member Functions

(id) - initWithFile:
(id) - initWithDictionary:
(id) - initWithTotalParticles:
 Initializes a system with a fixed number of particles.
(BOOL) - addParticle
 Add a particle to the emitter.
(void) - initParticle:
 Initializes a particle.
(void) - stopSystem
 stop emitting particles. Running particles will continue to run until they die
(void) - resetSystem
 Kill all living particles.
(BOOL) - isFull
 whether or not the system is full
(void) - updateQuadWithParticle:newPosition:
 should be overriden by subclasses
(void) - postStep
 should be overriden by subclasses

Static Public Member Functions

(id) + particleWithFile:

Properties

BOOL active
int particleCount
float duration
CGPoint centerOfGravity
CGPoint posVar
float life
float lifeVar
float angle
float angleVar
float startSize
float startSizeVar
float endSize
float endSizeVar
ccColor4F startColor
ccColor4F startColorVar
ccColor4F endColor
ccColor4F endColorVar
float emissionRate
int totalParticles
CCTexture2Dtexture
ccBlendFunc blendFunc
BOOL blendAdditive
tCCPositionType positionType
BOOL autoRemoveOnFinish
int emitterMode
CGPoint gravity
float speed
float speedVar
float tangentialAccel
float tangentialAccelVar
float radialAccel
float radialAccelVar
float startRadius
float startRadiusVar
float endRadius
float endRadiusVar
float rotatePerSecond
float rotatePerSecondVar

Detailed Description

Particle System base class Attributes of a Particle System:

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:

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

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

Definition at line 162 of file CCParticleSystem.h.


Member Function Documentation

- (BOOL) addParticle  

Add a particle to the emitter.

- (void) initParticle: (tCCParticle *)  particle  

Initializes a particle.

- (id) initWithDictionary: (NSDictionary *)  dictionary  

initializes a CCQuadParticleSystem from a NSDictionary.

Since:
v0.99.3
- (id) initWithFile: (NSString *)  plistFile  

initializes a CCParticleSystem from a plist file. This plist files can be creted manually or with Particle Designer: http://particledesigner.71squared.com/

Since:
v0.99.3
- (id) initWithTotalParticles: (int)  numberOfParticles  

Initializes a system with a fixed number of particles.

- (BOOL) isFull  

whether or not the system is full

+ (id) particleWithFile: (NSString *)  plistFile  

creates an initializes a CCParticleSystem from a plist file. This plist files can be creted manually or with Particle Designer: http://particledesigner.71squared.com/

Since:
v0.99.3
- (void) postStep  

should be overriden by subclasses

- (void) resetSystem  

Kill all living particles.

- (void) stopSystem  

stop emitting particles. Running particles will continue to run until they die

- (void) updateQuadWithParticle: (tCCParticle *)  particle
newPosition: (CGPoint)  pos 

should be overriden by subclasses


Property Documentation

- (BOOL) active [read, assign]

Is the emitter active

Definition at line 166 of file CCParticleSystem.h.

- (float) angle [read, write, assign]

angle and angle variation of each particle

Definition at line 179 of file CCParticleSystem.h.

- (float) angleVar [read, write, assign]

angle variance of each particle

Definition at line 181 of file CCParticleSystem.h.

- (BOOL) autoRemoveOnFinish [read, write, assign]

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

Since:
v0.8

Definition at line 392 of file CCParticleSystem.h.

- (BOOL) blendAdditive [read, write, assign]

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

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

Definition at line 383 of file CCParticleSystem.h.

- (ccBlendFunc) blendFunc [read, write, assign]

conforms to CocosNodeTexture protocol

Definition at line 375 of file CCParticleSystem.h.

- (CGPoint) centerOfGravity [read, write, assign]

centerOfGravity of the emitter

Definition at line 174 of file CCParticleSystem.h.

- (float) duration [read, write, assign]

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

Definition at line 168 of file CCParticleSystem.h.

- (float) emissionRate [read, write, assign]

emission rate of the particles

Definition at line 270 of file CCParticleSystem.h.

- (int) emitterMode [read, write, assign]

Switch between different kind of emitter modes:

  • kCCParticleModeGravity: uses gravity, speed, radial and tangential acceleration
  • kCCParticleModeRadius: uses radius movement + rotation

Definition at line 397 of file CCParticleSystem.h.

- (ccColor4F) endColor [read, write, assign]

end color and end color variation of each particle

Definition at line 245 of file CCParticleSystem.h.

- (ccColor4F) endColorVar [read, write, assign]

end color variance of each particle

Definition at line 247 of file CCParticleSystem.h.

- (float) endRadius [read, write, assign]

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

Definition at line 216 of file CCParticleSystem.h.

- (float) endRadiusVar [read, write, assign]

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

Definition at line 218 of file CCParticleSystem.h.

- (float) endSize [read, write, assign]

end size in pixels of each particle

Definition at line 231 of file CCParticleSystem.h.

- (float) endSizeVar [read, write, assign]

end size variance in pixels of each particle

Definition at line 233 of file CCParticleSystem.h.

- (CGPoint) gravity [read, write, assign]

Gravity value. Only available in 'Gravity' mode.

Definition at line 190 of file CCParticleSystem.h.

- (float) life [read, write, assign]

life, and life variation of each particle

Definition at line 236 of file CCParticleSystem.h.

- (float) lifeVar [read, write, assign]

life variance of each particle

Definition at line 238 of file CCParticleSystem.h.

- (int) particleCount [read, assign]

Quantity of particles that are being simulated at the moment

Definition at line 264 of file CCParticleSystem.h.

- (tCCPositionType) positionType [read, write, assign]

particles movement type: Free or Grouped

Since:
v0.8

Definition at line 387 of file CCParticleSystem.h.

- (CGPoint) posVar [read, write, assign]

Position variance of the emitter

Definition at line 176 of file CCParticleSystem.h.

- (float) radialAccel [read, write, assign]

radial acceleration of each particle. Only available in 'Gravity' mode.

Definition at line 203 of file CCParticleSystem.h.

- (float) radialAccelVar [read, write, assign]

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

Definition at line 205 of file CCParticleSystem.h.

- (float) rotatePerSecond [read, write, assign]

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

Definition at line 220 of file CCParticleSystem.h.

- (float) rotatePerSecondVar [read, write, assign]

Variance in degrees for rotatePerSecond. Only available in 'Radius' mode.

Definition at line 222 of file CCParticleSystem.h.

- (float) speed [read, write, assign]

speed of each particle. Only available in 'Gravity' mode.

Definition at line 193 of file CCParticleSystem.h.

- (float) speedVar [read, write, assign]

speed variance of each particle. Only available in 'Gravity' mode.

Definition at line 195 of file CCParticleSystem.h.

- (ccColor4F) startColor [read, write, assign]

start color of each particle

Definition at line 241 of file CCParticleSystem.h.

- (ccColor4F) startColorVar [read, write, assign]

start color variance of each particle

Definition at line 243 of file CCParticleSystem.h.

- (float) startRadius [read, write, assign]

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

Definition at line 212 of file CCParticleSystem.h.

- (float) startRadiusVar [read, write, assign]

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

Definition at line 214 of file CCParticleSystem.h.

- (float) startSize [read, write, assign]

start size in pixels of each particle

Definition at line 227 of file CCParticleSystem.h.

- (float) startSizeVar [read, write, assign]

size variance in pixels of each particle

Definition at line 229 of file CCParticleSystem.h.

- (float) tangentialAccel [read, write, assign]

tangential acceleration of each particle. Only available in 'Gravity' mode.

Definition at line 198 of file CCParticleSystem.h.

- (float) tangentialAccelVar [read, write, assign]

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

Definition at line 200 of file CCParticleSystem.h.

- (CCTexture2D*) texture [read, write, retain]

conforms to CocosNodeTexture protocol

Definition at line 373 of file CCParticleSystem.h.

- (int) totalParticles [read, write, assign]

maximum particles of the system

Definition at line 262 of file CCParticleSystem.h.


The documentation for this class was generated from the following file:
 All Classes Files Functions Variables Typedefs Enumerations Enumerator Properties Defines

cocos2d for iPhone 0.99.4 API Reference - Generated using Doxygen 1.7.1