Cocos2dx has provided us with a lot of particle system effects:
1. CCParticleExplosion explosion
2. CCParticleFire
3. CCParticleFireworks fireworks
4. CCParticleFlower
5. CCParticleGalaxy
6. CCParticleMeteor meteor
7. CCParticleRain rain
8. CCParticleSmoke snow
9. CCParticleSnow smoke
10. CCParticleSpiral spiral
11. CCParticleSun sun flame
Customize a CCParticleSystem Particle System
CCParticleSystem * ignore = CCParticleSystemQuad: create ("participant/SmallSun. plist ");
// Method 1
CCNode * parent1 = CCNode: create (); // create a node
// Method 2
CCNode * parent2 = CCParticleBatchNode: create (ignore-> getTexture ());
First:Create a CCParticleSystemQuad System: Each particle is represented by a four-point (Quad, rectangle) particle system.
CCParticleSystemQuad * emitter = CCParticleSystemQuad: create ("SmallSun. plist"); // SmallSun. plist is the file generated by the Particle System editing tool.
Second:Create a CCParticleSystemQuad System
CCParticleSystemQuad * m_emitter = new CCParticleSystemQuad ();
Std: string filename = "participant/" + "particle resource file name" + ". plist ";
M_emitter-> initWithFile (filename. c_str ());
Common settings:
Emitter1-> setStartColor (ccc4f (,); // set the particle RGBA Value
Emitter1-> setBlendAdditive (false); // whether to add a mixture
Emitter1-> setPosition (ccp (s. width/2-30, s. height/2 + 60 * neg); // you can specify the position of the emission particle.
Emitter-> setAutoRemoveOnFinish (true); // After completion, the brake is removed.
Parent1-> addChild (emitter1, 0, 1); Add the particle system to the node (you can also directly add it to a background genie CCSprite)
Layer-> addChild (parent1, 10,100 0 + I); then add it to the layer.
Common Parameters in CCParticleSystem:
// Vector of gravity and direction
CCPoint gravity;
// Speed
Float speed;
// Particle speed difference
Float speedVar;
// Tangent acceleration of Particles
Float tangentialAccel;
// Tangent acceleration Difference Between Particles
Float tangentialAccelVar;
// Radial Acceleration of Particles
Float radialAccel;
// Radial Acceleration Difference Between Particles
Float radialAccelVar;
// Particle start radius
Float startRadius;
// Start radius Difference Between Particles
Float startRadiusVar;
// Particle end radius
Float endRadius;
// Difference of the ending radius between particles
Float endRadiusVar;
// The Rotation Angle of the particle per second
Float rotatePerSecond;
// The rotation angle difference between particles per second
Float rotatePerSecondVar;