Cocos2d-x 3.0 development notes --- using progresst

Source: Internet
Author: User

Blood records are often used, and there is no need to write them again, which is a waste of time. Here we use the latest API to write one for future calls.

The engine version used by the following code is cocos2d-x 3.0rc0

1. RADIAL


Sprite * bgSprite = Sprite: create ("red.png"); addChild (bgSprite, 1, 1); Sprite * hpSprite = Sprite: create ("green.png "); progresstage = progresstage: create (hpSprite); progressTimer-> setType (ProgressTimer: Type: RADIAL); progressTimer-> setReverseProgress (true); progresstage-> setPercentage (30 ); // full value 100% addChild (progressTimer, 0, 0 );

2. BAR


Sprite * bgSprite = Sprite: create ("box.png"); addChild (bgSprite, 1, 1); Sprite * hpSprite = Sprite: create ("hp.png "); progressTimer = ProgressTimer: create (hpSprite); progressTimer-> setType (ProgressTimer: Type: BAR ); //////////////////////////////////////// //////////////////////////////////////// /////////////// // left-to-right progressTimer-> setMidpoint (ccp (0, 0.5); progressTimer-> setBarChangeRate (ccp (1, 0); // from right to left // progressTimer-> setMidpoint (ccp (1, 0.5 )); // progressTimer-> setBarChangeRate (ccp (1, 0); // from top to bottom // progressTimer-> setMidpoint (ccp (0.5, 1 )); // progressTimer-> setBarChangeRate (ccp (0, 1); // from bottom to top // progressTimer-> setMidpoint (ccp (0.5, 0 )); // progresstate-> setBarChangeRate (ccp (0, 1 )); //////////////////////////////////////// //////////////////////////////////////// //// // progressTimer-> setMidpoint (Point (0, 0.5); progressTimer-> setBarChangeRate (Point (1, 0); progressTimer-> setPercentage (30); // The full value is 100% addChild (progressTimer, 0, 0 );

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.