//Third,first和second的集合,使用TexturePacker工具,将精灵对象打包
auto spritebatch=CCSpriteBatchNode::create(“SpriteList.png”);
auto cache = CCSpriteFrameCache::sharedSpriteFrameCache();
cache->addSpriteFramesWithFile(“SpriteList.plist”);//加载plist文件
auto sp1 = CCSprite::createWithSpriteFrameName(“player1.png”);//使用第一帧精灵初始化对象,精灵对象的名字与plist中的名字一致
spritebatch->addChild(sp1);
this->addChild(spritebatch);
Vector<SpriteFrame*> arr1;
char str = {0};
for(int i = 1; i < 8; i++)
{
sprintf(str, “player%d.png”,i);//将精灵帧加载
auto frame = cache->spriteFrameByName(str);
arr1.pushBack(frame);
}
//执行动作
auto animation2 = Animation::createWithSpriteFrames(arr1,0.3f);
sp1->runAction(RepeatForever::create(Animate::create(animation2)));
这段是代码 代码是执行了但是看不到执行效果啊 运行就是一个图片在那也不动在线等