http://www.2cto.com/kf/201403/289326.html
血条经常会用到,没必要重复编写浪费时间,这里用最新版的API写个,方便以后调用。
以下代码使用的引擎版本是cocos2d-x 3.0rc0
1.RADIAL
Sprite *bgSprite = Sprite::create(
"red.png"
);
addChild(bgSprite,
1
,monospace!important; font-size:1em!important; min-height:auto!important; color:black!important; background:none!important">);
Sprite *hpSprite = Sprite::create(
"green.png"
);
progressTimer = ProgressTimer::create(hpSprite);
//设置进度条的模式
//kCCProgressTimerTypeBar表示条形模式
//默认的模式是kCCProgressTimerTypeRadial(圆圈模式)
progressTimer->setType(ProgressTimer::Type::RADIAL);
progressTimer->setReverseProgress(
true
);
progressTimer->setPercentage(
30
);
//满值 100%
);