Beispiel #1
0
//------------------------------------------------------------------
//
// ActionReverseSequence
//
//------------------------------------------------------------------
void ActionReverseSequence::onEnter()
{
    ActionsDemo::onEnter();

    alignSpritesLeft(1);

    CCActionInterval*  move1 = CCMoveBy::actionWithDuration(1, CGPointMake(250,0));
    CCActionInterval*  move2 = CCMoveBy::actionWithDuration(1, CGPointMake(0,50));
    CCFiniteTimeAction*  seq = CCSequence::actions( move1, move2, move1->reverse(), NULL);
    CCFiniteTimeAction*  action = CCSequence::actions( seq, seq->reverse(), NULL);

    m_grossini->runAction(action);
}
Beispiel #2
0
//------------------------------------------------------------------
//
// ActionReverseSequence2
//
//------------------------------------------------------------------
void ActionReverseSequence2::onEnter()
{
    ActionsDemo::onEnter();

    alignSpritesLeft(2);


    // Test:
    //   Sequence should work both with IntervalAction and InstantActions
    CCActionInterval*  move1 = CCMoveBy::actionWithDuration(1, CGPointMake(250,0));
    CCActionInterval*  move2 = CCMoveBy::actionWithDuration(1, CGPointMake(0,50));
    CCToggleVisibility*  tog1 = new CCToggleVisibility();
    CCToggleVisibility*  tog2 = new CCToggleVisibility();
    tog1->autorelease();
    tog2->autorelease();
    CCFiniteTimeAction*  seq = CCSequence::actions( move1, tog1, move2, tog2, move1->reverse(), NULL);
    CCActionInterval*  action = CCRepeat::actionWithAction((CCActionInterval*)(CCSequence::actions( seq, seq->reverse(), NULL)), 3);



    // Test:
    //   Also test that the reverse of Hide is Show, and vice-versa
    m_kathia->runAction(action);

    CCActionInterval*  move_tamara = CCMoveBy::actionWithDuration(1, CGPointMake(100,0));
    CCActionInterval*  move_tamara2 = CCMoveBy::actionWithDuration(1, CGPointMake(50,0));
    CCActionInstant*  hide = new CCHide();
    hide->autorelease();
    CCFiniteTimeAction*  seq_tamara = CCSequence::actions( move_tamara, hide, move_tamara2, NULL);
    CCFiniteTimeAction*  seq_back = seq_tamara->reverse();
    m_tamara->runAction( CCSequence::actions( seq_tamara, seq_back, NULL));
}