void Tutorial::startAnimateGuideRight(eTutorialState state)
{
    if (nullptr != _guideRight)
//    if (nullptr != _guideRight && false == _rightPressed)
    {
        this->stopAnimationGuideRight();
        ActionInterval * action = nullptr;
        switch (state)
        {
            case eTutorialState::TUTORIAL_CONTROLLER_RIGHT:
            case eTutorialState::TUTORIAL_CONTROLLER_JUMP_RIGHT:
                action = _animLongPress->clone();
                break;
            case eTutorialState::TUTORIAL_CONTROLLER_JUMP_LEFT:
            case eTutorialState::TUTORIAL_CONTROLLER_JUMP_VERTICAL:
                action = _animTap->clone();
                break;
            case eTutorialState::TUTORIAL_CONTROLLER_LEFT:
            case eTutorialState::TUTORIAL_NONE:
            default:
                break;
        }
        if (action)
        {
            action->setTag(static_cast<int>(eAction::ANIMATION));
            _guideRight->runAction(action);
        }
    }
}
Пример #2
0
void TestFrameEvent::onFrameEvent(cocostudio::Bone *bone, const std::string& evt, int originFrameIndex, int currentFrameIndex)
{
    CCLOG("(%s) emit a frame event (%s) at frame index (%d).", bone->getName().c_str(), evt.c_str(), currentFrameIndex);

    if (!_gridNode->getActionByTag(FRAME_EVENT_ACTION_TAG) || _gridNode->getActionByTag(FRAME_EVENT_ACTION_TAG)->isDone())
    {
        _gridNode->stopAllActions();

        ActionInterval *action =  ShatteredTiles3D::create(0.2f, Size(16,12), 5, false);
        action->setTag(FRAME_EVENT_ACTION_TAG);
        _gridNode->runAction(action);
    }
}
Пример #3
0
 void PixelMapPartial::PlaySmallAnimation(cocos2d::Sprite* s)
 {
   bool scaleDirection = rand()%2;
   auto s1 = ScaleTo::create(2, kSpriteScale*0.8);
   auto s2 = ScaleTo::create(2, kSpriteScale*1.1);
   ActionInterval* loop = nullptr;
   if (scaleDirection)
     loop = RepeatForever::create(Sequence::create(s1, s2, NULL));
   else
     loop = RepeatForever::create(Sequence::create(s2, s1, NULL));;
   loop->setTag(SMALL_ANIMATION_TAG);
   s->runAction(loop);
 }
Пример #4
0
//------------------------------------------------------------------
//
// RemoveTest
//
//------------------------------------------------------------------
void RemoveTest::onEnter()
{
    ActionManagerTest::onEnter();

    LabelTTF* l = LabelTTF::create("Should not crash", "Thonburi", 16);
    addChild(l);
    l->setPosition( ccp(VisibleRect::center().x, VisibleRect::top().y - 75) );

    MoveBy* pMove = MoveBy::create(2, ccp(200, 0));
    CallFunc* pCallback = CallFunc::create(this, callfunc_selector(RemoveTest::stopAction));
    ActionInterval* pSequence = Sequence::create(pMove, pCallback, NULL);
    pSequence->setTag(kTagSequence);

    Sprite* pChild = Sprite::create(s_pPathGrossini);
    pChild->setPosition( VisibleRect::center() );

    addChild(pChild, 1, kTagGrossini);
    pChild->runAction(pSequence);
}