|
cocos2d-mac
1.0.1
Improved Cocos2D API Reference (Mac OS X version) for Kobold2D developers
|
#include <CCParticleSystem.h>
Public Member Functions | |
| id | initWithFile: (NSString *plistFile) |
| id | initWithDictionary: (NSDictionary *dictionary) |
| id | initWithTotalParticles: (NSUInteger numberOfParticles) |
| Initializes a system with a fixed number of particles. | |
| BOOL | addParticle () |
| Add a particle to the emitter. | |
| void | initParticle: (tCCParticle *particle) |
| 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: (tCCParticle *particle,[newPosition] CGPoint pos) |
| should be overriden by subclasses | |
| void | postStep () |
| should be overriden by subclasses | |
| void | update: (ccTime dt) |
| called in every loop. | |
Static Public Member Functions | |
| id | particleWithFile: (NSString *plistFile) |
Protected Attributes | |
| float | elapsed |
| NSInteger | emitterMode_ |
| union { | |
| struct { | |
| CGPoint gravity | |
| float speed | |
| float speedVar | |
| float tangentialAccel | |
| float tangentialAccelVar | |
| float radialAccel | |
| float radialAccelVar | |
| } A | |
| struct { | |
| float startRadius | |
| float startRadiusVar | |
| float endRadius | |
| float endRadiusVar | |
| float rotatePerSecond | |
| float rotatePerSecondVar | |
| } B | |
| } | mode |
| tCCParticle * | particles |
| float | emitCounter |
| CCTexture2D * | texture_ |
| ccBlendFunc | blendFunc_ |
| tCCPositionType | positionType_ |
| BOOL | autoRemoveOnFinish_ |
| NSUInteger | particleIdx |
| CC_UPDATE_PARTICLE_IMP | updateParticleImp |
| SEL | updateParticleSel |
Properties | |
| BOOL | active |
| NSUInteger | particleCount |
| float | duration |
| CGPoint | sourcePosition |
| 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 | startSpin |
| float | startSpinVar |
| float | endSpin |
| float | endSpinVar |
| float | emissionRate |
| NSUInteger | totalParticles |
| CCTexture2D * | texture |
| ccBlendFunc | blendFunc |
| BOOL | blendAdditive |
| tCCPositionType | positionType |
| BOOL | autoRemoveOnFinish |
| NSInteger | emitterMode |
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;
| BOOL CCParticleSystem::addParticle | ( | ) | [virtual] |
Add a particle to the emitter.
| void CCParticleSystem::initParticle: | ( | tCCParticle * | particle | ) | [virtual] |
Initializes a particle.
| id CCParticleSystem::initWithDictionary: | ( | NSDictionary * | dictionary | ) | [virtual] |
initializes a CCQuadParticleSystem from a NSDictionary.
| id CCParticleSystem::initWithFile: | ( | NSString * | plistFile | ) | [virtual] |
initializes a CCParticleSystem from a plist file. This plist files can be creted manually or with Particle Designer: http://particledesigner.71squared.com/
| id CCParticleSystem::initWithTotalParticles: | ( | NSUInteger | numberOfParticles | ) | [virtual] |
Initializes a system with a fixed number of particles.
| BOOL CCParticleSystem::isFull | ( | ) | [virtual] |
whether or not the system is full
| id CCParticleSystem::particleWithFile: | ( | NSString * | plistFile | ) | [static, virtual] |
creates an initializes a CCParticleSystem from a plist file. This plist files can be creted manually or with Particle Designer: http://particledesigner.71squared.com/
| void CCParticleSystem::postStep | ( | ) | [virtual] |
should be overriden by subclasses
| void CCParticleSystem::resetSystem | ( | ) | [virtual] |
Kill all living particles.
| void CCParticleSystem::stopSystem | ( | ) | [virtual] |
stop emitting particles. Running particles will continue to run until they die
| void CCParticleSystem::update: | ( | ccTime | dt | ) | [virtual] |
called in every loop.
| void CCParticleSystem::updateQuadWithParticle:newPosition: | ( | tCCParticle * | particle, |
| [newPosition] CGPoint | pos | ||
| ) | [virtual] |
should be overriden by subclasses
BOOL CCParticleSystem::active [read, assign] |
Is the emitter active
float CCParticleSystem::angle [read, write, assign] |
angle and angle variation of each particle
float CCParticleSystem::angleVar [read, write, assign] |
angle variance of each particle
BOOL CCParticleSystem::autoRemoveOnFinish [read, write, assign] |
whether or not the node will be auto-removed when it has no particles left. By default it is NO.
BOOL CCParticleSystem::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;
ccBlendFunc CCParticleSystem::blendFunc [read, write, assign] |
conforms to CocosNodeTexture protocol
float CCParticleSystem::duration [read, write, assign] |
How many seconds the emitter wil run. -1 means 'forever'
float CCParticleSystem::emissionRate [read, write, assign] |
emission rate of the particles
NSInteger CCParticleSystem::emitterMode [read, write, assign] |
Switch between different kind of emitter modes:
ccColor4F CCParticleSystem::endColor [read, write, assign] |
end color and end color variation of each particle
ccColor4F CCParticleSystem::endColorVar [read, write, assign] |
end color variance of each particle
float CCParticleSystem::endRadius [read, write, assign] |
The ending radius of the particles. Only available in 'Radius' mode.
float CCParticleSystem::endRadiusVar [read, write, assign] |
The ending radius variance of the particles. Only available in 'Radius' mode.
float CCParticleSystem::endSize [read, write, assign] |
end size in pixels of each particle
float CCParticleSystem::endSizeVar [read, write, assign] |
end size variance in pixels of each particle
CGPoint CCParticleSystem::gravity [read, write, assign] |
Gravity value. Only available in 'Gravity' mode.
float CCParticleSystem::life [read, write, assign] |
life, and life variation of each particle
float CCParticleSystem::lifeVar [read, write, assign] |
life variance of each particle
NSUInteger CCParticleSystem::particleCount [read, assign] |
Quantity of particles that are being simulated at the moment
tCCPositionType CCParticleSystem::positionType [read, write, assign] |
particles movement type: Free or Grouped
CGPoint CCParticleSystem::posVar [read, write, assign] |
Position variance of the emitter
float CCParticleSystem::radialAccel [read, write, assign] |
radial acceleration of each particle. Only available in 'Gravity' mode.
float CCParticleSystem::radialAccelVar [read, write, assign] |
radial acceleration variance of each particle. Only available in 'Gravity' mode.
float CCParticleSystem::rotatePerSecond [read, write, assign] |
Number of degress to rotate a particle around the source pos per second. Only available in 'Radius' mode.
float CCParticleSystem::rotatePerSecondVar [read, write, assign] |
Variance in degrees for rotatePerSecond. Only available in 'Radius' mode.
CGPoint CCParticleSystem::sourcePosition [read, write, assign] |
sourcePosition of the emitter
float CCParticleSystem::speed [read, write, assign] |
speed of each particle. Only available in 'Gravity' mode.
float CCParticleSystem::speedVar [read, write, assign] |
speed variance of each particle. Only available in 'Gravity' mode.
ccColor4F CCParticleSystem::startColor [read, write, assign] |
start color of each particle
ccColor4F CCParticleSystem::startColorVar [read, write, assign] |
start color variance of each particle
float CCParticleSystem::startRadius [read, write, assign] |
The starting radius of the particles. Only available in 'Radius' mode.
float CCParticleSystem::startRadiusVar [read, write, assign] |
The starting radius variance of the particles. Only available in 'Radius' mode.
float CCParticleSystem::startSize [read, write, assign] |
start size in pixels of each particle
float CCParticleSystem::startSizeVar [read, write, assign] |
size variance in pixels of each particle
float CCParticleSystem::tangentialAccel [read, write, assign] |
tangential acceleration of each particle. Only available in 'Gravity' mode.
float CCParticleSystem::tangentialAccelVar [read, write, assign] |
tangential acceleration variance of each particle. Only available in 'Gravity' mode.
CCTexture2D* CCParticleSystem::texture [read, write, retain] |
conforms to CocosNodeTexture protocol
NSUInteger CCParticleSystem::totalParticles [read, write, assign] |
maximum particles of the system