[Cocos2D-X] initial view door diameter (6) Particle System

Source: Internet
Author: User

Method 1: Customize [cpp] // create a particle system CCParticleSystem * pparticipant lesystem = new CCParticleSystemQuad (); // generate 300 particles pparticipant lesystem-> initwithtotalparticipant (300 ); // set the particle image pparticipant system-> setTexture (CCTextureCache: sharedTextureCache ()-> addImage ("yezi.png ")); // set the duration of the Particle System (pparticipant lesystem-> setDuration (-1); // set the gravity direction (pparticipant lesystem-> setGravity (CCPointZero); // set the angle, angle Change Rate (pparticipant lesystem)-> setAngle (0); pparticipant lesystem-> setAngleVar (360); // you can set the motion speed and the speed change rate (pparticipant lesystem-> setSpeed (50 ); pparticipant lesystem-> setSpeedVar (10); // you can specify the Radial Acceleration and the change rate of Radial Acceleration. For example, you can specify the value of setRadialAccel (70). For more information, see setRadialAccelVar (10). // set the tangent acceleration, the ratio of change of Radial Acceleration pparticipant lesystem-> setTangentialAccel (80); pparticipant lesystem-> setTangentialAccelVar (0); // you can specify the initial position and position change rate of a particle. width/2, mSize. height/2); pparticle system-> setPosVar (ccp (100,100); // you can specify the time when the particle exists and the time change rate (pparticipant lesystem-> setLife (2 ); pparticipant lesystem-> setLifeVar (0.3); // sets the initial color of the particle, the color change rate ccColor4F cccStart = {0.5, 0.5, 0.5}; pparticipant lesystem-> setStartColor (cccStart ); pparticipant lesystem-> setStartColorVar (cccStart); // set the particle end color, color change rate ccColor4F cccEnd = {0.5, 0.5, 0.5, 1.0}; pparticipant lesystem-> setStartColor (cccEnd ); pparticipant lesystem-> setStartColorVar (cccEnd); // you can specify the initial particle size and the ratio of change in size. For example, you can specify the initial particle size. For more information, see setStartSizeVar (20). // you can specify the particle ending size, size Change Rate pparticipant lesystem-> setStartSize (12); pparticipant lesystem-> setStartSizeVar (12); // you can specify the number of particles generated per second () /pparticipant lesystem-> getLife (); this-> addChild (pparticipant lesystem, 1);: Method 2: Use the built-in [cpp] CCParticleSystem * m_emitter; m_emitter = CCParticleFireworks :: create (); m_emitter-> retain (); this-> addChild (m_emitter, 10); m_emitter-> setTexture (CCTextureCache: sharedTextureCache () -> addImage ("yezi.png"); m_emitter-> setPosition (ccp (300,320);: Other: [cpp] -- CCParticleSystem (parent class of all particle systems) -- CCParticleSystemPoint, CCParticleSystemQuad point particle and square Particle System -- CCParticleExplosion (explosive particle effect) -- CCParticleFireworks -- CCParticleFire (flame particle effect) -- CCParticleFlower (bouquet particle effect) -- CCParticleGalaxy (Galaxy particle effect) -- CCParticleMeteor (meteor particle effect) -- CCParticleSpiral (vortex particle effect) -- CCParticleSnow (snow particle effect) -- CCParticleSmoke (smoke particle effect) -- CCParticleSun (Sun particle effect) -- CCParticleRain (rain particle effect) method 3: Use the plist file [cpp] CCParticleSystemQuad * system = CCParticleSystemQuad: create ("lizi. plist "); system-> setPosition (ccp (mSize. width/2, mSize. height/2); this-> addChild (system, 1 );

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.