1,英雄被砍的时候的掉血效果,这里提供一种思路,还有其他的感觉这个比较简单分享一下
CCSprite* l_banker = CCSprite::create("bankerbg.png");
l_banker->setposition(ccp(600,500));
addChild(l_banker,10);
CCSprite* l_redbar = CCSprite::create("minusBlood2.png");
m_totalbanker_progressbar= CCProgresstimer::create(l_redbar);
m_totalbanker_progressbar->setMIDpoint(CCPointMake(0,0.5));
m_totalbanker_progressbar->setType(kCCProgresstimerTypebar);
m_totalbanker_progressbar->setbarChangeRate(CCPointMake(1,0));
m_totalbanker_progressbar->setposition(ccp(l_banker->boundingBox().getMIDX(),l_banker->boundingBox().getMaxY() -30));
addChild(m_totalbanker_progressbar,11);
m_totalbanker_progressbar->setPercentage(100);
CCSprite* l_greenbar = CCSprite::create("redbar.png");
m_totalcanbet_progressbar= CCProgresstimer::create(l_greenbar);
m_totalcanbet_progressbar->setMIDpoint(CCPointMake(0,0.5));
m_totalcanbet_progressbar->setType(kCCProgresstimerTypebar);
m_totalcanbet_progressbar->setbarChangeRate(CCPointMake(1,0));
m_totalcanbet_progressbar->setposition(ccp(l_banker->boundingBox().getMIDX(),l_banker->boundingBox().getMaxY() -30));
addChild(m_totalcanbet_progressbar,11);
m_totalcanbet_progressbar->setPercentage(100);
static int a =100; // _progressbar->progressto(a); a+=30; if (a>100) { a=0; } m_nextper =a; int b = m_totalcanbet_progressbar->getPercentage(); CCProgressFromTo *to2 = CCProgressFromTo::create(0.1,b,a); m_totalcanbet_progressbar->runAction(to2); CCFadeOut*l_fadeout = CCFadeOut::create(0.5); CCCallFunc* l_call =CCCallFunc::create(this,callfunc_selector(HelloWorld::beAttactedFinished)); CCSequence* l_bankerbeattackseq = CCSequence::create(l_fadeout,l_call,NulL); m_totalbanker_progressbar->runAction(l_bankerbeattackseq);
总结以上是内存溢出为你收集整理的cocos2d-x 进度条实现(被砍)掉血效果全部内容,希望文章能够帮你解决cocos2d-x 进度条实现(被砍)掉血效果所遇到的程序开发问题。
如果觉得内存溢出网站内容还不错,欢迎将内存溢出网站推荐给程序员好友。
欢迎分享,转载请注明来源:内存溢出
评论列表(0条)