newlist

  博客园 :: 首页 :: 博问 :: 闪存 :: 新随笔 :: 联系 :: 订阅 订阅 :: 管理 ::

 

CCActionInterval* createEffect(int nIndex, float t)
{

    CCDirector::sharedDirector()->setDepthTest(false);

    switch(nIndex)
    {
        case 0: return Shaky3DDemo::create(t);
        case 1: return Waves3DDemo::create(t);
        case 2: return FlipX3DDemo::create(t);
        case 3: return FlipY3DDemo::create(t);
        case 4: return Lens3DDemo::create(t);
        case 5: return Ripple3DDemo::create(t);
        case 6: return LiquidDemo::create(t);
        case 7: return WavesDemo::create(t);
        case 8: return TwirlDemo::create(t);
        case 9: return ShakyTiles3DDemo::create(t);
        case 10: return ShatteredTiles3DDemo::create(t);
        case 11: return ShuffleTilesDemo::create(t);
        case 12: return FadeOutTRTilesDemo::create(t);
        case 13: return FadeOutBLTilesDemo::create(t);
        case 14: return FadeOutUpTilesDemo::create(t);
        case 15: return FadeOutDownTilesDemo::create(t);
        case 16: return TurnOffTilesDemo::create(t);
        case 17: return WavesTiles3DDemo::create(t);
        case 18: return JumpTiles3DDemo::create(t);
        case 19: return SplitRowsDemo::create(t);
        case 20: return SplitColsDemo::create(t);
        case 21: return PageTurn3DDemo::create(t);
    }

    return NULL;
}
CCActionInterval* getAction()
{
    CCActionInterval* pEffect = createEffect(actionIdx, 3);

    return pEffect;
} 
//创建一个新的节点
    CCNode* node = CCNode::create();
    CCActionInterval* effect = getAction();
//通过该节点执行动作
    node->runAction(effect);
//将该节点添加进去
    addChild(node, 0, kTagBackground);
    
    CCSprite *bg = CCSprite::create(s_back3);
//将精灵添加到节点当中,这样添加进去的精灵也会随着结点一起动作
    node->addChild(bg, 0);

 

posted on 2013-07-23 14:41  一枚程序  阅读(283)  评论(0编辑  收藏  举报