0

I am loading a TMX tile map into sprite kit using JSTileMap and the issue I am having is that if I use a tileSet.png the tiles appear too big when displayed. If I use a tileSet@2x.png the tiles appear the correct size but my tmx map does not show correctly instead all I see is the tileSet in a grid. I have tried renaming the tileSet@2x.png to tileSet.png but once again the tiles appear too big.

Can I use a tileSet@2x.png with JSTileMap?

The tiles in both png files are 128x128

Any help is appreciated.

TazmanNZL
  • 372
  • 3
  • 16

1 Answers1

0

It sounds like the tile size in your TMX map is set to points, not pixels. Open your TMX map file in a text editor and check to make sure all the numbers are in pixels, not points.

Here is an example of some of the XML you will see.

<map version="1.0" orientation="orthogonal" width="78" height="30" tilewidth="16" tileheight="16">
 <tileset firstgid="1" name="Peacesong_smallProps" tilewidth="16" tileheight="16">
  <image source="Peacesong_smallProps.png" width="208" height="128"/>
 </tileset>
 <tileset firstgid="105" name="Peacesong_mediumProps" tilewidth="32" tileheight="32">
  <image source="Peacesong_mediumProps.png" width="96" height="64"/>
 </tileset>
 <tileset firstgid="111" name="Peacesong_largeProps" tilewidth="48" tileheight="48">
  <image source="Peacesong_largeProps.png" width="384" height="96"/>
 </tileset>
...
</map>

If you are sure this is not the problem, please submit an issue on github here and I'll take a look.

slycrel
  • 4,275
  • 2
  • 30
  • 30
  • The XML file looks fine. If I change the xml file in Xcode by setting the tile width and height to be half it works fine. But then when I open it in tiled it's all messed up. So I have to have 128x128 tiles for tiled and 64x64 for SpriteKit. My XML file has: – TazmanNZL Aug 25 '14 at 02:17
  • Have a look at this question that may be related as well. http://stackoverflow.com/questions/21001806/how-does-jstilemap-handle-retina-and-ipad-iphone-tile-maps – slycrel Aug 25 '14 at 02:25
  • Yeah looks like he had to half the tile size in the tmx file so sprite kit would read it also. It's a bit of pain. – TazmanNZL Aug 25 '14 at 02:38
  • I think this is due to using the @2x named files. If you do not use the 2x prefix then the file works properly. Again, if this is a continued issue, please upload a sample map in an issue on github and I'll take a more in-depth look at it. – slycrel Aug 25 '14 at 03:22