CCActionInterval* move1 = CCMoveBy::create(1, ccp(250,0)); CCActionInterval* move2 = CCMoveBy::create(1, ccp(0,50)); CCToggleVisibility* tog1 = new CCToggleVisibility(); CCToggleVisibility* tog2 = new CCToggleVisibility(); tog1->autorelease(); tog2->autorelease(); //目前的理解是夹在tog1和tog2间的move2将不显示中间的过渡动作, //动作的时间到了之后精灵就直接显示在动作的结果位置 CCFiniteTimeAction* seq = CCSequence::create( move1, tog1, move2, tog2, move1->reverse(), NULL); CCActionInterval* action = CCRepeat::create((CCActionInterval*)(CCSequence::create( seq, seq->reverse(), NULL)), 3);
void ActionRepeat::onEnter() { ActionsDemo::onEnter(); alignSpritesLeft(2); CCActionInterval* a1 = CCMoveBy::create(1, ccp(150,0)); CCActionInterval* action1 = CCRepeat::create( //动作组:先在(60,60)位置显示,然后执行动作a1 //对该动作组重复执行3次 CCSequence::create( CCPlace::create(ccp(60,60)), a1, NULL) , 3); CCAction* action2 = CCRepeatForever::create( (CCActionInterval*)(CCSequence::create((CCActionInterval*)(a1->copy()->autorelease()), a1->reverse(), NULL)) ); m_kathia->runAction(action1); m_tamara->runAction(action2); }