我有一个8192 * 8192的大型精灵表,cocos2dx不支持它。因此我分成3块(每块4096 * 4096)。但是如何按顺序运行sprite-sheet?
这是我的代码的一部分。我是cocos2dx的新手。
cocos2d::SpriteFrameCache* cache_1 = cocos2d::SpriteFrameCache::getInstance();
cache_1->addSpriteFramesWithFile("cutSceneTexture_1.plist");
// same for cache_2 and cache_3 ...
SpriteBatchNode* spritebatch_1 = SpriteBatchNode::create("cutSceneTexture_1.png");
// same for spritebatch_2, and spritebatch_3 ...
Sprite* spriteFrameOne = Sprite::createWithSpriteFrameName("InfectionAnimation1.png");
spriteFrameOne->setPosition(cocos2d::Point(visibleSize.width/2, visibleSize.height/2));
spritebatch_1->addChild(spriteFrameOne);
this->addChild(spritebatch_1, 5);
// same for spriteFrameTwo and spriteFrameThree but different frameName...
cocos2d::Vector<SpriteFrame*> animFrames_1(18);
cocos2d::Vector<SpriteFrame*> animFrames_2(18);
cocos2d::Vector<SpriteFrame*> animFrames_3(18);
char str[100] = {0};
for(int i = 1; i <= 18; i++)
{
sprintf(str, "InfectionAnimation%d.png", i);
SpriteFrame* frame = cache_1->getSpriteFrameByName( str );
animFrames_1.pushBack(frame);
}
// ... same for animFrames_2 and animFrames_3
auto animation_1 = Animation::createWithSpriteFrames(animFrames_1, 0.08f);
auto animate_1 = Animate::create(animation_1);
auto animation_2 = Animation::createWithSpriteFrames(animFrames_2, 0.08f);
auto animate_2 = Animate::create(animation_2);
auto animation_3 = Animation::createWithSpriteFrames(animFrames_3, 0.08f);
auto animate_3 = Animate::create(animation_3);
// Question: how to make those three sprite frame animations run in sequence??
spriteFrameOne->runAction(animate_1);
spriteFrameTwo->runAction(animate_2);
spriteFrameThree->runAction(animate_3);
感谢!!!