Question

I'm using Cocos2D v0.99.5 for iOS. I resized a tile atlas pixel width/height from 256x512 to 256x1024. I adjusted the tile size width and height properties in the project's tmx file accordingly. If I draw in a tile anywhere below 512 in the tile atlas, I get the assertion failure "Only 1 tilset per layer is supported" even though I'm drawing the tiles on the correct layer.

I know it should support tile atlases up to 1024x1024 pixels or twice that with retina. I'm using an iPad 3. Any clue to why this is happening?

Was it helpful?

Solution

This may very well have something to do with the tileset size. When resizing the tileset you have to make sure that the information stored in the TMX file is also updated accordingly.

Assume you have a 256x256 tileset with 64x64 tiles. That means this particular tileset will have tiles with GIDs ranging from 0 to 15. Now if you increase the width of this tileset to 512x256 then the tileset range is 0 to 31. The important bit here is that the location of the same GID may change depending on which tileset image is being used and the tileset size stored in the TMX file.

This discrepancy results in the lookup of a tile GID that supposedly can't be in the layer's one tileset, according to cocos2d. Hence it complains that you may be trying to use tiles from a different tileset on the layer.

Always make sure the TMX tileset info matches that of the actual tileset image. To be very sure, delete the app from the device and perform a clean build to ensure the app is rebuilt and transferred as a whole to the device.

OTHER TIPS

Pretty sure its not because of tileSet image size : 256x1024.

This error comes when you use tile from 2 different tileSet in single layer !

So use tiles from one tileSet in one layer. You can add multiple layers in one map, but each layers contains tiles from unique tileSet.

enter image description here

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top