本文整理汇总了C++中CCProgressTimer::getPercentage方法的典型用法代码示例。如果您正苦于以下问题:C++ CCProgressTimer::getPercentage方法的具体用法?C++ CCProgressTimer::getPercentage怎么用?C++ CCProgressTimer::getPercentage使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类CCProgressTimer
的用法示例。
在下文中一共展示了CCProgressTimer::getPercentage方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: changeEnergyBarAnimation
void ASBot::changeEnergyBarAnimation(int _dif){
CCProgressTimer* energyBar = (CCProgressTimer*)this->getChildByTag(2*10000000+20);
int percentage = energyBar->getPercentage();
CCProgressFromTo* action = CCProgressFromTo::create(0.015*(abs(moveCount*100/moveToFight-percentage)), percentage, moveCount*100/moveToFight);
CCSequence* seq = CCSequence::create(action,NULL);
energyBar->runAction(seq);
}
示例2: startWithTarget
void CCProgressTo::startWithTarget(CCNode* pTarget)
{
CCProgressTimer* progressTimer = dynamic_cast<CCProgressTimer*>(pTarget);
if (progressTimer)
{
CCActionInterval::startWithTarget(pTarget);
m_fFrom = progressTimer->getPercentage();
// XXX: Is this correct ?
// Adding it to support CCRepeat
if (m_fFrom == 100)
{
m_fFrom = 0;
}
}
}
示例3: changeHeart
void ASGame::changeHeart(int _shengming,int _source){
shengming += _shengming;
if (shengming<=0)
shengming = 0;
//1.血条
CCProgressTimer* heartBar = (CCProgressTimer*)this->getChildByTag(1*10000000+2222);
CCProgressFromTo* action = CCProgressFromTo::create(0.5, heartBar->getPercentage(), (float)shengming/(float)maxShengMing*100);
heartBar->runAction(action);
if ((float)shengming <= 0.4*(float)maxShengMing){
heartBar->getSprite()->setColor(ccc3(237, 45, 37));
if(!MainUser->muted){
CocosDenshion::SimpleAudioEngine::sharedEngine()->stopEffect(heartSoundEffect);
heartSoundEffect = CocosDenshion::SimpleAudioEngine::sharedEngine()->playEffect("noHeart.wav", true);
}
}else{
heartBar->getSprite()->setColor(ccc3(255, 255, 255));
if(!MainUser->muted)
CocosDenshion::SimpleAudioEngine::sharedEngine()->stopEffect(heartSoundEffect);
}
//2.生命数字
string HeartStr = int2string(shengming) + "/" + int2string(maxShengMing);
CCLabelTTF* heartLabel = (CCLabelTTF*)this->getChildByTag(playerNumber*10000000+2223);
heartLabel->setString(HeartStr.c_str());
//3.判断胜利条件
if (shengming == 0 && !((GameBaseClass*)getParent())->gameover){
((GameBaseClass*)getParent())->gameover = true;
//1.禁用各种按钮
CCMenu* skillMenu = (CCMenu*)this->getChildByTag(1*10000000+27);
CCMenu* optionMenu = (CCMenu*)this->getChildByTag(1*10000000+12);
CCMenu* itemMenu = (CCMenu*)this->getChildByTag(1*10000000+77776);
skillMenu->setTouchEnabled(false);
optionMenu->setTouchEnabled(false);
itemMenu->setTouchEnabled(false);
//2.停止所有监听
unscheduleAllSelectors();
bot2->unscheduleAllSelectors();
//3.结束页面
((GameBaseClass*)getParent())->GameResult(1);
}
}
示例4: changeEnergyBarAnimation
void ASGame::changeEnergyBarAnimation(int _dif){
CCProgressTimer* energyBar = (CCProgressTimer*)this->getChildByTag(playerNumber*10000000+20);
CCProgressTimer* attackButton = (CCProgressTimer*)this->getChildByTag(1*10000000+25);
int percentage = energyBar->getPercentage();
//1.上方行动力槽
CCProgressFromTo* action = CCProgressFromTo::create(0.015*(abs(moveCount*100/moveToFight-percentage)), percentage, moveCount*100/moveToFight);
energyBar->runAction(action);
//2.下方攻击按钮槽
CCProgressFromTo* action1 = CCProgressFromTo::create(0.015*(abs(moveCount*100/moveToFight-percentage)), percentage, moveCount*100/moveToFight);
attackButton->runAction(action1);
//3.能量条盖子
/*
CCSprite* energyBarCover = (CCSprite*)this->getChildByTag(player 28);
energyBarCover->setOpacity(255);
float tmpScale = (sqrt(pow(107, 2) - pow((abs((int)(107-_pixel))),2))*2)/214;
energyBarCover->setScale(tmpScale);
energyBarCover->setPosition(ccp(size.width*179/200, size.height/13.5 - (215-_pixel)/2*tmpScale));
*/
}