可以用flash创建 .plist 和 .png
auto cache = SpriteFrameCache::getInstance();
cache->addSpriteFramesWithFile("..\\Resources\\anim.plist");
Vector<SpriteFrame*> vec;
char name[15];
for (int i = 0; i < 20; i++){
sprintf(name,"anim%04d",i);
vec.pushBack(cache->getSpriteFrameByName(name));
}
auto animation = Animation::createWithSpriteFrames(vec,0.1f); //帧容器, 两帧间隔
auto animate = Animate::create(animation); //创建动画
auto sprite = Sprite::create(); //利用精灵显示动画
sprite->setPosition(visibleSize / 2);
this->addChild(sprite);
sprite->runAction(Repeat::create(animate,3)); //利用Repeat循环播放