ActionTestCCAnimationCCAnimateCCAnimationCache執(zhí)行動(dòng)畫的三步驟1.根據(jù)文件創(chuàng)建Animation    --(1)多張圖..."/>
溫馨提示×

溫馨提示×

您好,登錄后才能下訂單哦!

密碼登錄×
登錄注冊×
其他方式登錄
點(diǎn)擊 登錄注冊 即表示同意《億速云用戶服務(wù)條款》

cocos2d-x 動(dòng)畫播放

發(fā)布時(shí)間:2020-07-19 11:35:57 來源:網(wǎng)絡(luò) 閱讀:479 作者:VincentTung 欄目:游戲開發(fā)
與動(dòng)畫相關(guān)的類   效果展示 TestCpp->ActionTest
CCAnimation
CCAnimate
CCAnimationCache
執(zhí)行動(dòng)畫的三步驟
1.根據(jù)文件創(chuàng)建Animation
   --(1)多張圖片
   --(2)一張合成圖片 plist
2.根據(jù)Animation創(chuàng)建Animate
3.執(zhí)行Animate
//1.多張分的的圖片
    // Manual animation
    //
    CCAnimation* animation = CCAnimation::create();
    for( int i=1;i<15;i++)
    {
        char szName[100] = {0};
        sprintf(szName, "Images/grossini_dance_%02d.png", i);
        animation->addSpriteFrameWithFileName(szName);
    }
    // should last 2.8 seconds. And there are 14 frames.
    animation->setDelayPerUnit(2.8f / 14.0f);
    animation->setRestoreOriginalFrame(true);
    CCAnimate* action = CCAnimate::create(animation);
    m_grossini->runAction(CCSequence::create(action, action->reverse(), NULL));
    //2.plist圖片加載
    // File animation
    //
    // With 2 loops and reverse
 //AnimationCache預(yù)加載的使用
    CCAnimationCache *cache = CCAnimationCache::sharedAnimationCache();
    cache->addAnimationsWithFile("animations/animations-2.plist");
    CCAnimation *animation2 = cache->animationByName("dance_1");
    CCAnimate* action2 = CCAnimate::create(animation2);
    m_tamara->runAction(CCSequence::create(action2, action2->reverse(), NULL));
AnimationCache預(yù)加載的使用

//學(xué)習(xí)如何使用工具

拼圖工具:

TexturePacker

Zwoptex

骨骼動(dòng)畫:

cocosbuilder

cocostudio

紅孩兒


向AI問一下細(xì)節(jié)

免責(zé)聲明:本站發(fā)布的內(nèi)容(圖片、視頻和文字)以原創(chuàng)、轉(zhuǎn)載和分享為主,文章觀點(diǎn)不代表本網(wǎng)站立場,如果涉及侵權(quán)請聯(lián)系站長郵箱:is@yisu.com進(jìn)行舉報(bào),并提供相關(guān)證據(jù),一經(jīng)查實(shí),將立刻刪除涉嫌侵權(quán)內(nèi)容。

AI