質問

In attempting to create a texture atlas using Texture Packer with a number of sprites, I received a Texture Packer error "8 not fitting sprites - try using multipacking".

So, I see that under Layout on the Texture Packer UI, there is a button to click that says "Multipack". It also provides a help that says you must use a tag such as {n1} so that the multiple output files are uniquely named. This works fine and creates (in my case) 2 plist files and 2 png files (e.g. GameObjectAtlas1-iPad.plist, GameObjectAtlas2-iPad.plist, GameObjectAtlas1-iPad.png, and GameObjectAtlas2-iPad.png).

Now that I have these multiple files, how you actually load these into a cocos2D project. For a single pair of files, the code would be:

[[CCSpriteFrameCache sharedSpriteFrameCache] addSpriteFramesWithFile: @"GameObjectAtlas-iPad.plist"];
CCSpriteBatchNode *sceneSpriteBatchNode = [CCSpriteBatchNode batchNodeWithFile:@"GameObjectAtlas-iPad.png"];

How do you load both GameObjectAtlas1-iPad.png and GameObjectAtlas2-iPad.png into the batch node?

役に立ちましたか?

解決

You can't. One batch node, one texture.

Maybe this feature is intended mainly for engines that better (automatically) manage batching, such as Sprite Kit/Kobold Kit.

ライセンス: CC-BY-SA帰属
所属していません StackOverflow
scroll top