本文整理汇总了C++中CCAction::isDone方法的典型用法代码示例。如果您正苦于以下问题:C++ CCAction::isDone方法的具体用法?C++ CCAction::isDone怎么用?C++ CCAction::isDone使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类CCAction
的用法示例。
在下文中一共展示了CCAction::isDone方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: ccTouchesEnded
void TestController::ccTouchesEnded(CCSet *pTouches, CCEvent *pEvent)
{
CCAction* delaytime = CCActionManager::sharedManager()->getActionByTag(99,this);
if(delaytime != NULL)
if(delaytime->isDone() == false)
{
CCSetIterator it = pTouches->begin();
CCTouch* touch = (CCTouch*)(*it);
CCPoint p1 = m_tBeginPos;
CCPoint p2 = touch->locationInView(touch->view());
float x = m_pItmeMenu->getPosition().x + (p2.x - p1.x) * 5;
if(x>= 0)
x = 0;
else if(x <= -m_pItmeMenu->getContentSize().width)
x = -m_pItmeMenu->getContentSize().width;
CCMoveTo* move = CCMoveTo::actionWithDuration(1,CCPointMake(x,0));
CCActionInterval* ease = CCEaseOut::actionWithAction(move,3.0);
m_pItmeMenu->runAction(ease);
}
}
示例2: update
void GameScene::update(float delta)
{
bool oldCrashed = m_Crashed;
if (m_Started && !m_Paused)
{
if (!m_Crashed)
{
float deltaX = m_fForwordVelocity * delta;
// move background
m_pBackground1->setPositionX(m_pBackground1->getPositionX() + deltaX);
m_pBackground2->setPositionX(m_pBackground1->getPositionX() + m_pBackground1->getContentSize().width);
if (m_pBackground1->getPositionX() + m_pBackground1->getContentSize().width / 2 <= m_VisibleOrigin.x)
{
CCSprite *pTemp = m_pBackground1;
m_pBackground1 = m_pBackground2;
m_pBackground2 = pTemp;
m_pBackground2->setPositionX(m_pBackground1->getPositionX() + m_pBackground1->getContentSize().width);
}
// move pillars
for (int i = 0; i < 4; i++)
{
if (m_Pillars[i] != NULL)
{
m_Pillars[i]->setPositionX(m_Pillars[i]->getPositionX() + deltaX);
float w = m_pPig->getContentSize().width * m_pPig->getScaleX(), h = m_pPig->getContentSize().height * m_pPig->getScaleY();
CCRect pigRect = CCRectMake(m_pPig->getPositionX() - w / 2, m_pPig->getPositionY() - h / 2, w, h);
if (m_Pillars[i]->boundingBox().intersectsRect(pigRect))
{
m_Crashed = true;
//m_Pillars[i]->setPositionX(m_pPig->getPositionX() + m_pPig->getContentSize().width * m_pPig->getScale() / 2 + 44);
}
}
}
}
// fall & rotate pig
CCAction *pAction = m_pPig->getActionByTag(kTagRaise);
if (!pAction || pAction->isDone())
{
m_fFallVelocity += -1400 * delta;
m_fFallVelocity = MAX(m_fFallVelocity, m_fMaxVelocity);
float posY = m_pPig->getPositionY() +m_fFallVelocity * delta;
if (posY <= m_VisibleOrigin.y + m_GroundPosY + m_pPig->getContentSize().height / 2)
{
posY = m_VisibleOrigin.y + m_GroundPosY + m_pPig->getContentSize().height / 2;
m_Crashed = true;
}
m_pPig->setPositionY(posY);
float orgRotation = m_pPig->getRotation();
float rotation = 0;
if (orgRotation < -24)
{
rotation = orgRotation + delta * 10;
}
else if (orgRotation < -22)
{
rotation = orgRotation + delta * 30;
}
else if (orgRotation < -16)
{
rotation = orgRotation + delta * 60;
}
else
{
rotation = orgRotation + delta * 500;
}
rotation = MIN(rotation, 80);
m_pPig->setRotation(rotation);
}
if (m_Crashed)
{
if (!oldCrashed)
{
m_pPig->stopAllActions();
GameManager *gameManager = GameManager::getInstance();
gameManager->addGoalToday();
if (gameManager->getGoalsToday() >= 2 && m_CurrentScore >= 5 && gameManager->getRated() == false && gameManager->getLaterTS() != Util::getCurrentDays())
{
showRateView();
}
else
{
showOverView();
}
if (m_Sound)
{
CocosDenshion::SimpleAudioEngine::sharedEngine()->playEffect(SFX_HIT);
scheduleOnce(schedule_selector(GameScene::playDieEffect), 0.5f);
}
}
}
//.........这里部分代码省略.........