Animation of Particles

Hi all, I would like to share a class which I wrote. Its called AdvanceParticleQuadSystem and its basically an easier way to animate particles. You can do things like setting frame rate. Its like CCParticleSystemQuad and has additional thing to animate particles using texture or CCsprite.

Animation of Particles:

Description:
It extends from CCParticleSystem and has all properties included in CCParticleSystem. Using of this class is similar to CCParticleSystemQuad.

General Settings:
Its has all settings declared in CCParticleSystem.

Advance Settings:

  1. Setting Frame rate.
  2. Particle animation.
  3. Recycle particle after finish animaiton.
  4. Repeat animation until life to 0.
    I had declared two function instead of setDisplayFrame and setTextureWithRect in CCParticleSystemQuad as setDisplayFrameForAnimation and setTextureWithRectForAnimation in AdvanceParticleQuadSystem

Example Code:

//Create class which extends from AdvanceParticleQuadSystem to set properties to CCParticleSystem.
//ParticleEmitter class which extends from AdvanceParticleQuadSystem.
myEmmiter = new ParticleEmitter();
myEmmiter~~>initWithParticleCount;
myEmmiter~~>setGravity(ccp(0, (minus)100));
myEmmiter~~>setSpeed;
myEmmiter~~>setSpeedVar(0);
myEmmiter~~>setLife;
myEmmiter~~>setLifeVar(2.0);
myEmmiter~~>setEmissionRate;
ccColor4F m_StartColor = ;
ccColor4F m_Variancecolor = ;
myEmmiter~~>setEndColor(m_StartColor);
myEmmiter~~>setEndColorVar;
myEmmiter~~>setStartSize(30);
myEmmiter~~>setStartSizeVar;
myEmmiter~~>setAngle(90);
myEmmiter~~>setAngleVar;
myEmmiter~~>setBlendFunc((ccBlendFunc){GL_ONE, GL_ONE_MINUS_SRC_COLOR});
//Settings Texture and number of tile images along row nad column, frame rate and Boolean to recycle particle after animation.
myEmmiter->setTextureWithRectForAnimation(CCTexture2D *texture, CCRect rect, int tileWidth, int tileHeight, int number_Frames_per_Second, bool NeedsToRemoveParticleAfterAniamtion);


Advance_Particle_Quad_System.zip (264.7 KB)

Nice share, again!