创建动画一般过程:
1、创建精灵框架缓存,并向其中添加相应的动画文件(plist),最后,通过动画集缓存生产动画
CCSpriteFrameCache *cache = CCSpriteFrameCache::sharedSpriteFrameCache();
cache->addSpriteFramesWithFile("animations/grossini.plist");
cache->addSpriteFramesWithFile("animations/grossini_gray.plist", "animations/grossini_gray.png");
CCSpriteBatchNode *spritebatch = CCSpriteBatchNode::create("animations/grossini.png");//用于批量生产精灵
CCArray* animFrames = CCArray::createWithCapacity(15);//动态生成数组,类似于vector
for(int i = 1; i < 4; i++)
{
//sprintf的作用是字符串格式化,主要功能是把格式化的数据写入某个字符串中。sprintf(str, “ani_conch_%d.png”, 1)后str的值就变成了:ani_conch_1.png
sprintf(str, "grossini_blue_%02d.png",i);//两位数字,不够的话,用零补全
CCSpriteFrame *frame = cache->spriteFrameByName(str);
animFrames->addObject(fra