一、粒子系统简介:
id="iframe_0.34039534838360086" src="data:text/html;charset=utf8,%3Cimg%20id=%22img%22%20src=%22http://img1.51cto.com/attachment/201201/135620606.png?_=2447571%22%20style=%22border:none;max-width:993px%22%3E%3Cscript%3Ewindow.onload%20=%20function%20()%20%7Bvar%20img%20=%20document.getElementById('img');%20window.parent.postMessage(%7BiframeId:'iframe_0.34039534838360086',width:img.width,height:img.height%7D,%20'http://www.cnblogs.com');%7D%3C/script%3E" frameborder="0" scrolling="no" style="margin: 0px; padding: 0px; border-width: initial; border-style: none; width: 395px; height: 225px;">
id="iframe_0.8985666659583798" src="data:text/html;charset=utf8,%3Cimg%20id=%22img%22%20src=%22http://img1.51cto.com/attachment/201201/141203332.png?_=2447571%22%20style=%22border:none;max-width:993px%22%3E%3Cscript%3Ewindow.onload%20=%20function%20()%20%7Bvar%20img%20=%20document.getElementById('img');%20window.parent.postMessage(%7BiframeId:'iframe_0.8985666659583798',width:img.width,height:img.height%7D,%20'http://www.cnblogs.com');%7D%3C/script%3E" frameborder="0" scrolling="no" style="margin: 0px; padding: 0px; border-width: initial; border-style: none; width: 711px; height: 305px;">
m_emitter = CCParticleFireworks::node();
m_emitter->retain();
this->addChild(m_emitter, 10);
m_emitter->setTexture( CCTextureCache::sharedTextureCache()->addImage(“image.png”) );
m_emitter->setPosition(ccp( 489, 320));
m_emitter = new CCParticleSystemQuad();
m_emitter->initWithTotalParticles( 50);
this->addChild(m_emitter, 10);
m_emitter->setTexture( CCTextureCache::sharedTextureCache()->addImage(s_stars1) );
m_emitter->setDuration(- 1);
// gravity
m_emitter->setGravity(CCPointZero);
// angle
m_emitter->setAngle( 90);
m_emitter->setAngleVar( 360);
// speed of particles
m_emitter->setSpeed( 160);
m_emitter->setSpeedVar( 20);
// radial
m_emitter->setRadialAccel(- 120);
m_emitter->setRadialAccelVar( 0);
// tagential
m_emitter->setTangentialAccel( 30);
m_emitter->setTangentialAccelVar( 0);
// emitter position
m_emitter->setPosition( CCPointMake( 160, 240) );
m_emitter->setPosVar(CCPointZero);
// life of particles
m_emitter->setLife( 4);
m_emitter->setLifeVar( 1);
// spin of particles
m_emitter->setStartSpin( 0);
m_emitter->setStartSizeVar( 0);
m_emitter->setEndSpin( 0);
m_emitter->setEndSpinVar( 0);
// color of particles
ccColor4F startColor = { 0.5f, 0.5f, 0.5f, 1.0f};
m_emitter->setStartColor(startColor);
ccColor4F startColorVar = { 0.5f, 0.5f, 0.5f, 1.0f};
m_emitter->setStartColorVar(startColorVar);
ccColor4F endColor = { 0.1f, 0.1f, 0.1f, 0.2f};
m_emitter->setEndColor(endColor);
ccColor4F endColorVar = { 0.1f, 0.1f, 0.1f, 0.2f};
m_emitter->setEndColorVar(endColorVar);
// size, in pixels
m_emitter->setStartSize( 80.0f);
m_emitter->setStartSizeVar( 40.0f);
m_emitter->setEndSize(kParticleStartSizeEqualToEndSize);
// emits per second
m_emitter->setEmissionRate(m_emitter->getTotalParticles()/m_emitter->getLife());
// additive
m_emitter->setIsBlendAdditive( true);
system->initWithFile( " Images/SpinningPeas.plist "); // plist文件可以通过例子编辑器获得
system->setTextureWithRect(CCTextureCache::sharedTextureCache()->addImage( " Images/particles.png ")
, CCRectMake( 0, 0, 32, 32));
addChild(system, 10);
system->setPosition