Domanda

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?

È stato utile?

Soluzione

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.

Autorizzato sotto: CC-BY-SA insieme a attribuzione
Non affiliato a StackOverflow
scroll top