当前位置: 首页>>代码示例>>C++>>正文


C++ CCProgressTimer::getPercentage方法代码示例

本文整理汇总了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);
}
开发者ID:nooboracle,项目名称:ForTest,代码行数:9,代码来源:ASBotEnergyBar.cpp

示例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;
    	}
	}
}
开发者ID:IppClub,项目名称:Dorothy,代码行数:15,代码来源:CCActionProgressTimer.cpp

示例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);
    }
}
开发者ID:nooboracle,项目名称:ForTest,代码行数:47,代码来源:ASHeart.cpp

示例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));
     */
}
开发者ID:nooboracle,项目名称:ForTest,代码行数:23,代码来源:ASEnergyBar.cpp


注:本文中的CCProgressTimer::getPercentage方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。