Example of Cocos2d-x3.1 particle effect

Source: Internet
Author: User

Example of Cocos2d-x3.1 particle effect

Here, we stick several effects of particles for future use.

 

 

//// IntervalLayer. cpp // testthirdone /// Created by du jia on 14-7-7. //// # include IntervalLayer. h # define SID_STEP1 100 # define SID_STEP2 101 # define SID_STEP3 102 # define IDC_PAUSE 200 bool IntervalLayer: init () {return true;} IntervalLayer: IntervalLayer () {_ time0 = _ time1 = _ time2 = _ time3 = _ time4 = 0.0f; auto s = Director: getInstance ()-> getWinSize (); auto sun = participant sun :: create (); sun-> setTexture (Director: getInstance ()-> getTextureCache ()-> addImage(fire.png); sun-> setPosition (Vec2 (s. width/2-100, s. height/2); sun-> settotalparticipant (130); sun-> setLife (5.0f); this-> addChild (sun); // timers auto fire = participant fire :: create (); fire-> setTexture (Director: getInstance ()-> getTextureCache ()-> addImage(fire.png); fire-> setPosition (Vec2 (s. width/2 + 50, s. height/2); fire-> settotaltaskles (130); fire-> setLife (5.0f); this-> addChild (fire); auto fireworks = FIG: create (); fireworks-> setTexture (Director: getInstance ()-> getTextureCache ()-> addImage(fire.png); fireworks-> setPosition (Vec2 (s. width/2 + 50, s. height/2-200); fireworks-> settotalparticipant (130); fireworks-> setLife (5.0f); this-> addChild (fireworks); auto galaxy = participant galaxy :: create (); galaxy-> setTexture (Director: getInstance ()-> getTextureCache ()-> addImage(fire.png); galaxy-> setPosition (Vec2 (50, s. height/2 + 200); galaxy-> settotalparticipant (130); galaxy-> setLife (5.0f); this-> addChild (galaxy); auto flower = participant flower :: create (); flower-> setTexture (Director: getInstance ()-> getTextureCache ()-> addImage(fire.png); flower-> setPosition (Vec2 (250, s. height/2 + 200); flower-> settotalparticipant (130); flower-> setLife (5.0f); this-> addChild (flower); // meteor auto meteor = MAID:: create (); meteor-> setTexture (Director: getInstance ()-> getTextureCache ()-> addImage(fire.png); meteor-> setPosition (Vec2 (250, 20 )); meteor-> settotalparticipant (130); meteor-> setLife (5.0f); this-> addChild (meteor); // vortex auto spiral = participant spiral: create (); spiral-> setTexture (Director: getInstance ()-> getTextureCache ()-> addImage(fire.png); spiral-> setPosition (Vec2 (450, 40 )); spiral-> settotalparticipant (130); spiral-> setLife (5.0f); this-> addChild (spiral); // blast auto explosion = participant explosion: create (); explosion-> setTexture (Director: getInstance ()-> getTextureCache ()-> addImage(fire.png); explosion-> setPosition (Vec2 (50,440 )); explosion-> settotalparticipant (130); explosion-> setLife (5.0f); this-> addChild (explosion); // smoke auto smoke = participant Moke: create (); smoke-> setTexture (Director: getInstance ()-> getTextureCache ()-> addImage(fire.png); smoke-> setPosition (Vec2 (450,640 )); smoke-> settotalparticipant (130); smoke-> setLife (5.0f); this-> addChild (smoke); // snow auto snow = FIG: create (); snow-> setTexture (Director: getInstance ()-> getTextureCache ()-> addImage(fire.png); snow-> setPosition (Vec2 (450,840 )); snow-> settotalparticipant (130); snow-> setLife (5.0f); this-> addChild (snow); // rain auto rain = FIG: create (); rain-> setTexture (Director: getInstance ()-> getTextureCache ()-> addImage(fire.png); rain-> setPosition (Vec2 (450,940 )); rain-> settotalparticipant (130); rain-> setLife (5.0f); this-> addChild (rain );}

:

 

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.