cocos2d-x 血量条 CCProgressTimer实现

cocos2d-x 血量条 CCProgressTimer实现,第1张

概述直接上代码 //背景图片,         auto* hpBgSprite = Sprite::create("hpbg.png"); hpBgSprite->setPosition(Point(visibleSize.width/2, visibleSize.height/2-100 ));        this->addChild(hpBgSprite);     //有血量的图片 aut

直接上代码

//背景图片,

auto* hpBgSprite = Sprite::create("hpbg.png");

hpBgSprite->setposition(Point(visibleSize.wIDth/2,visibleSize.height/2-100 ));
this->addChild(hpBgSprite);

//有血量的图片

auto hpbar = CCProgresstimer::create(Sprite::create("hp.png")); hpbar->setType(Progresstimer::Type::bar); hpbar->setMIDpoint(Point(0,0.5f)); hpbar->setbarChangeRate(Point(1,0)); hpbar->setPercentage(50);//血量 hpbar->setposition(Point(0,0));//坐标点,相对于背景的 hpbar->setAnchorPoint(Point(0,0));//锚点 hpBgSprite->addChild(hpbar); 总结

以上是内存溢出为你收集整理的cocos2d-x 血量条 CCProgressTimer实现全部内容,希望文章能够帮你解决cocos2d-x 血量条 CCProgressTimer实现所遇到的程序开发问题。

如果觉得内存溢出网站内容还不错,欢迎将内存溢出网站推荐给程序员好友。

欢迎分享,转载请注明来源:内存溢出

原文地址:https://www.54852.com/web/1024801.html

(0)
打赏 微信扫一扫微信扫一扫 支付宝扫一扫支付宝扫一扫
上一篇 2022-05-23
下一篇2022-05-23

发表评论

登录后才能评论

评论列表(0条)

    保存