@H_404_0@程序实例1:创建一个烟花效果的方法1
CCSize winSize = CCDirector::sharedDirector()->getWinSize(); //烟花效果 CCParticleFireworks* fw = CCParticleFireworks::create(); addChild(fw); fw->setPosition(ccp(winSize.width / 2,winSize.height / 2));
@H_404_0@执行结果: @H_404_0@ @H_404_0@
@H_404_0@程序实例2:创建一个烟花效果的方法2
CCSize winSize = CCDirector::sharedDirector()->getWinSize(); //烟花效果 CCParticleSystemQuad* p = CCParticleFireworks::create(); addChild(p); p->setPosition(winSize.width / 2,winSize.height / 2);@H_404_0@
@H_404_0@执行结果:
@H_404_0@
@H_404_0@程序实例3:创建一个星云效果
CCSize winSize = CCDirector::sharedDirector()->getWinSize(); //星云效果 CCParticleSystemQuad* p2 = CCParticleGalaxy::create(); addChild(p2); p2->setPosition(ccp(winSize.width / 2,winSize.height / 2));@H_404_0@
@H_404_0@执行结果: @H_404_0@
@H_404_0@
@H_404_0@程序实例4:创建一个彗星效果 @H_404_0@
CCSize winSize = CCDirector::sharedDirector()->getWinSize(); //彗星效果 CCParticleSystemQuad* p2 = CCParticleMeteor::create(); addChild(p2); p2->setPosition(ccp(winSize.width / 2,winSize.height / 2));
@H_404_0@执行结果:
@H_404_0@
@H_404_0@程序实例5:创建一个花束效果 @H_404_0@
CCSize winSize = CCDirector::sharedDirector()->getWinSize(); //鲜花效果 CCParticleSystemQuad* p2 = CCParticleFlower::create(); addChild(p2); p2->setPosition(ccp(winSize.width / 2,winSize.height / 2));
@H_404_0@执行结果:
@H_404_0@
@H_404_0@程序实例6:创建一个火焰效果 @H_404_0@
CCSize winSize = CCDirector::sharedDirector()->getWinSize(); //火焰效果 CCParticleSystemQuad* p2 = CCParticleFire::create(); addChild(p2); p2->setPosition(ccp(winSize.width / 2,winSize.height / 2));
@H_404_0@执行结果: @H_404_0@ @H_404_0@
@H_404_0@程序实例7:5个效果放在一起展示 @H_404_0@
CCSize winSize = CCDirector::sharedDirector()->getWinSize(); //烟花效果 CCParticleSystemQuad* p1 = CCParticleFireworks::create(); //星云效果 CCParticleSystemQuad* p2 = CCParticleGalaxy::create(); //火焰效果 CCParticleSystemQuad* p3 = CCParticleFire::create(); //彗星效果 CCParticleSystemQuad* p4 = CCParticleMeteor::create(); //鲜花效果 CCParticleSystemQuad* p5 = CCParticleFlower::create(); addChild(p1); addChild(p2); addChild(p3); addChild(p4); addChild(p5); p1->setPosition(ccp(100,winSize.height / 2)); p2->setPosition(ccp(200,winSize.height / 2)); p3->setPosition(ccp(300,winSize.height / 2)); p4->setPosition(ccp(400,winSize.height / 2)); p5->setPosition(ccp(500,winSize.height / 2));
@H_404_0@执行效果: @H_404_0@ @H_404_0@
@H_404_0@程序实例8:执行人工编辑的粒子 @H_404_0@
CCSize winSize = CCDirector::sharedDirector()->getWinSize(); CCParticleSystemQuad* p = CCParticleSystemQuad::create("Particles/Galaxy.plist"); addChild(p); p->setPosition(ccp(winSize.width / 2,winSize.height / 2));
@H_404_0@执行结果: @H_404_0@ @H_404_0@
@H_404_0@程序实例8:执行可以移动的粒子
CCLayer::init(); CCSize winSize = CCDirector::sharedDirector()->getWinSize(); CCParticleSystemQuad* p = CCParticleSystemQuad::create("Particles/Flower.plist"); addChild(p); p->setPosition(ccp(100,winSize.height / 2)); CCMoveBy* by = CCMoveBy::create(4,ccp(winSize.width,0)); p->runAction( CCRepeatForever::create( CCSequence::create(by,by->reverse(),NULL) ) );@H_404_0@
@H_404_0@执行结果: @H_404_0@
@H_404_0@