CCRepeatForever和CCDelayTime

时间:2023-03-10 03:02:01
CCRepeatForever和CCDelayTime

有限次执行一组动作和无限次执行一组动作

void ActionRotateJerk::onEnter()
{
ActionsDemo::onEnter(); centerSprites(); CCFiniteTimeAction* seq = CCSequence::create(
CCRotateTo::create(0.5f, -),
CCRotateTo::create(0.5f, ),
NULL); CCActionInterval* rep1 = CCRepeat::create(seq, );
CCAction* rep2 = CCRepeatForever::create( (CCActionInterval*)(seq->copy()->autorelease()) ); m_tamara->runAction(rep1);
m_kathia->runAction(rep2);
}

执行一个动作之后,延时,再执行下一个动作

void ActionDelayTime::onEnter()
{
ActionsDemo::onEnter(); alignSpritesLeft(); CCActionInterval* move = CCMoveBy::create(, ccp(,));
CCFiniteTimeAction* action = CCSequence::create( move, CCDelayTime::create(), move, NULL); m_grossini->runAction(action);
}