|
cocos2d-iphone
2.1
Improved Cocos2D API Reference (iOS version) for www.kobold2d.com developers
|
#import <CCParticleSystem.h>
Instance Methods | |
| (id) | - initWithFile: |
| (id) | - initWithDictionary: |
| (id) | - initWithDictionary:path: |
| (id) | - initWithTotalParticles: |
| Initializes a system with a fixed number of particles. | |
| (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 | |
| (void) | - update: |
| called in every loop. | |
| (void) | - updateWithNoTime |
| Instance Methods inherited from CCNode | |
| (id) | - init |
| (void) | - onEnter |
| (void) | - onEnterTransitionDidFinish |
| (void) | - onExit |
| (void) | - onExitTransitionDidStart |
| (void) | - addChild: |
| (void) | - addChild:z: |
| (void) | - addChild:z:tag: |
| (void) | - removeFromParent |
| (void) | - removeFromParentAndCleanup: |
| (void) | - removeChild: |
| (void) | - removeChild:cleanup: |
| (void) | - removeChildByTag: |
| (void) | - removeChildByTag:cleanup: |
| (void) | - removeAllChildren |
| (void) | - removeAllChildrenWithCleanup: |
| (CCNode *) | - getChildByTag: |
| (void) | - reorderChild:z: |
| (void) | - sortAllChildren |
| (void) | - cleanup |
| (void) | - draw |
| (void) | - visit |
| (void) | - transform |
| (void) | - transformAncestors |
| (CGRect) | - boundingBox |
| (CCAction *) | - runAction: |
| (void) | - stopAllActions |
| (void) | - stopAction: |
| (void) | - stopActionByTag: |
| (CCAction *) | - getActionByTag: |
| (NSUInteger) | - numberOfRunningActions |
| (void) | - scheduleUpdate |
| (void) | - scheduleUpdateWithPriority: |
| (void) | - unscheduleUpdate |
| (void) | - schedule: |
| (void) | - schedule:interval: |
| (void) | - schedule:interval:repeat:delay: |
| (void) | - scheduleOnce:delay: |
| (void) | - unschedule: |
| (void) | - unscheduleAllSelectors |
| (void) | - resumeSchedulerAndActions |
| (void) | - pauseSchedulerAndActions |
| (CGAffineTransform) | - nodeToParentTransform |
| (CGAffineTransform) | - parentToNodeTransform |
| (CGAffineTransform) | - nodeToWorldTransform |
| (CGAffineTransform) | - worldToNodeTransform |
| (CGPoint) | - convertToNodeSpace: |
| (CGPoint) | - convertToWorldSpace: |
| (CGPoint) | - convertToNodeSpaceAR: |
| (CGPoint) | - convertToWorldSpaceAR: |
| (CGPoint) | - convertTouchToNodeSpace: |
| (CGPoint) | - convertTouchToNodeSpaceAR: |
| (void) | - setIsRelativeAnchorPoint: |
| (BOOL) | - DEPRECATED_ATTRIBUTE |
| (void) | - setZOrder: |
| Instance Methods inherited from <CCTextureProtocol> | |
| (CCTexture2D *) | - texture |
| (void) | - setTexture: |
| Instance Methods inherited from <CCBlendProtocol> | |
| (void) | - setBlendFunc: |
| (ccBlendFunc) | - blendFunc |
Class Methods | |
| (id) | + particleWithFile: |
| (id) | + particleWithTotalParticles: |
| Class Methods inherited from CCNode | |
| (id) | + node |
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 |
| NSUInteger | allocatedParticles |
| float | emitCounter |
| CCTexture2D * | texture_ |
| ccBlendFunc | blendFunc_ |
| BOOL | opacityModifyRGB_ |
| tCCPositionType | positionType_ |
| BOOL | autoRemoveOnFinish_ |
| NSUInteger | particleIdx |
| CC_UPDATE_PARTICLE_IMP | updateParticleImp |
| SEL | updateParticleSel |
| CCParticleBatchNode * | batchNode_ |
| NSUInteger | atlasIndex_ |
| BOOL | transformSystemDirty_ |
| Protected Attributes inherited from CCNode | |
| float | rotationX_ |
| float | rotationY_ |
| float | scaleX_ |
| float | scaleY_ |
| float | vertexZ_ |
| CGPoint | position_ |
| float | skewX_ |
| float | skewY_ |
| CGPoint | anchorPointInPoints_ |
| CGPoint | anchorPoint_ |
| CGSize | contentSize_ |
| CGAffineTransform | transform_ |
| CGAffineTransform | inverse_ |
| CCCamera * | camera_ |
| CCGridBase * | grid_ |
| NSInteger | zOrder_ |
| CCArray * | children_ |
| CCNode * | parent_ |
| NSInteger | tag_ |
| void * | userData_ |
| id | userObject_ |
| CCGLProgram * | shaderProgram_ |
| ccGLServerState | glServerState_ |
| NSUInteger | orderOfArrival_ |
| CCScheduler * | scheduler_ |
| CCActionManager * | actionManager_ |
| BOOL | isRunning_ |
| BOOL | isTransformDirty_ |
| BOOL | isInverseDirty_ |
| BOOL | visible_ |
| BOOL | ignoreAnchorPointForPosition_ |
| BOOL | isReorderChildDirty_ |
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:
| - (id) initWithDictionary: | (NSDictionary *) | dictionary |
initializes a particle system from a NSDictionary.
| - (id) initWithDictionary: | (NSDictionary *) | dictionary | |
| path: | (NSString *) | dirname | |
initializes a particle system from a NSDictionary and the path from where to load the png
| - (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/
| - (id) initWithTotalParticles: | (NSUInteger) | 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/
| - (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
|
readnonatomicassign |
Is the emitter active
|
readwritenonatomicassign |
angle and angle variation of each particle
|
readwritenonatomicassign |
angle variance of each particle
|
readwritenonatomicassign |
whether or not the node will be auto-removed when it has no particles left. By default it is NO.
|
readwritenonatomicassign |
weak reference to the CCSpriteBatchNode that renders the CCSprite
|
readwritenonatomicassign |
whether or not the particles are using blend additive. If enabled, the following blending function will be used.
|
readwritenonatomicassign |
conforms to CocosNodeTexture protocol
|
readwritenonatomicassign |
How many seconds the emitter wil run. -1 means 'forever'
|
readwritenonatomicassign |
emission rate of the particles
|
readwritenonatomicassign |
Switch between different kind of emitter modes:
|
readwritenonatomicassign |
end color and end color variation of each particle
|
readwritenonatomicassign |
end color variance of each particle
|
readwritenonatomicassign |
The ending radius of the particles. Only available in 'Radius' mode.
|
readwritenonatomicassign |
The ending radius variance of the particles. Only available in 'Radius' mode.
|
readwritenonatomicassign |
end size in pixels of each particle
|
readwritenonatomicassign |
end size variance in pixels of each particle
|
readwritenonatomicassign |
Gravity value. Only available in 'Gravity' mode.
|
readwritenonatomicassign |
life, and life variation of each particle
|
readwritenonatomicassign |
life variance of each particle
|
readwritenonatomicassign |
does the alpha value modify color
|
readnonatomicassign |
Quantity of particles that are being simulated at the moment
|
readwritenonatomicassign |
particles movement type: Free or Grouped
|
readwritenonatomicassign |
Position variance of the emitter
|
readwritenonatomicassign |
radial acceleration of each particle. Only available in 'Gravity' mode.
|
readwritenonatomicassign |
radial acceleration variance of each particle. Only available in 'Gravity' mode.
|
readwritenonatomicassign |
Number of degress to rotate a particle around the source pos per second. Only available in 'Radius' mode.
|
readwritenonatomicassign |
Variance in degrees for rotatePerSecond. Only available in 'Radius' mode.
|
readwritenonatomicassign |
sourcePosition of the emitter
|
readwritenonatomicassign |
speed of each particle. Only available in 'Gravity' mode.
|
readwritenonatomicassign |
speed variance of each particle. Only available in 'Gravity' mode.
|
readwritenonatomicassign |
start color of each particle
|
readwritenonatomicassign |
start color variance of each particle
|
readwritenonatomicassign |
The starting radius of the particles. Only available in 'Radius' mode.
|
readwritenonatomicassign |
The starting radius variance of the particles. Only available in 'Radius' mode.
|
readwritenonatomicassign |
start size in pixels of each particle
|
readwritenonatomicassign |
size variance in pixels of each particle
|
readwritenonatomicassign |
tangential acceleration of each particle. Only available in 'Gravity' mode.
|
readwritenonatomicassign |
tangential acceleration variance of each particle. Only available in 'Gravity' mode.
|
readwritenonatomicretain |
conforms to CocosNodeTexture protocol
|
readwritenonatomicassign |
maximum particles of the system