[Share] ExplosionParticleDemo – using an improved CCParticleSystem

This is demo is for the latest game special effect competition held by cocoachina forum. The theme this time is – particle explosion effect.

After looking into the CCParticleSystem class in cocos2d framework I found that the support for changing the property of each particle during its life time is quite limited. You can only set the particle property by specifying the startXXX, endXXX, startXXXVar, endXXXVar while initializing. (and it supports linear function type only)

YouTube Preview Image

So I made some changes to the CCParticleSystem class.

Here is some features of the demo:

1. A extented CCParticleSystem, CCParticleSystemQuad class
. support scaleX, scaleY
. using delegate to update specified property of each particles during their life time
support delegate::
-(void) updateParticleSize:(tCCParticle *)p elapsed:(float)e dt:(float)dt;
-(void) updateParticleScale:(tCCParticle *)p elapsed:(float)e dt:(float)dt;
-(void) updateParticleSpeed:(tCCParticle *)p elapsed:(float)e dt:(float)dt;
-(void) updateParticleAngle:(tCCParticle *)p elapsed:(float)e dt:(float)dt;
-(void) updateParticleRotation:(tCCParticle *)p elapsed:(float)e dt:(float)dt;
-(void) updateParticleRadialAccel:(tCCParticle *)p elapsed:(float)e dt:(float)dt;
-(void) updateParticleColor:(tCCParticle *)p elapsed:(float)elapse dt:(float)dt;
-(void) updateParticleTangentialAccel:(tCCParticle *)p elapsed:(float)e dt:(float)dt;
-(void) updateParticleRidus:(tCCParticle *)p elapsed:(float)e dt:(float)dt;
-(void) updateParticleDegreesPerSecond:(tCCParticle *)p elapsed:(float)e dt:(float)dt;
. support animated particle (merged from cocos2d-iphone-1.1-beta2b)
. new macro to control the spin and angle property

2. CCSlidingMenuLayer
A sliding menu layer I made.

3. CCFrameSprite
A frame sprite I made.

4. ShatteredSprite
Once introduced on my blog – a class to create “break effect” on any CCSprite.

5. CCRemoveAndCleanupAction
Coming together with ShatteredSprite.

6. CCShake
Found on the cocos2d forum – perfect for creating a “Shake Screen” effect.

7. BParticleManager
A manger class for particle optimization.

8. CCMath.h
Some useful macro for using the elementary functions.

9. Various explosion effect classes
Lots of explosion effect unit

10. CCParticleEffectGenerator
Creating cool explosion effects by group up the explosion effect unit in different ways.

Using the particle delegate allows you more control of the particle properties during its life time. You can use piecewise function && quadratic function, power function, trigonometric function … to bring more cool effect to the particle system.

To Download Page…

If you feel all the stuffs in this site helped you a lot and you can get a game I made 🙂


Leave a Reply

Your email address will not be published. Required fields are marked *

  1. Pingback: List of Open Source Cocos2d Projects, Extensions and Code Snippets | iUridium

  2. 非常好的效果,
    貌似我下的代码是基于 cocos2d v2.1-beta2 的, 里面的CCParticleSystem的startWidthScale 等等, 在v2.1 里木有, 这个需要怎么移植到 v2.1上?