//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预加载的使用 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预加载的使用
//学习如何使用工具
拼图工具:
TexturePacker
Zwoptex
骨骼动画:
cocosbuilder
cocostudio
红孩儿
免责声明:本站发布的内容(图片、视频和文字)以原创、转载和分享为主,文章观点不代表本网站立场,如果涉及侵权请联系站长邮箱:is@yisu.com进行举报,并提供相关证据,一经查实,将立刻删除涉嫌侵权内容。