1
\$\begingroup\$

SpriteKit supports tile maps as of iOS 10 and has a pretty powerful engine. Only, I am having trouble discovering if it is possible, and how to natively create, tile sets directly from a tileset image.

For example, it seems that many other tile map programs (such as Tiled) support uploading a single tileset image with a few inputs (16x16 tiles at 64px for each tile, for example) to create an array of tile textures. The only way that I've found to integrate this with Xcode's new SKTileSet feature is to manually crop each tile into it's own image, upload that image into a separate texture, and access them via name.

Is there a better way to upload a tile map image and access its tiles using Apple's SKTileMapNode engine?

\$\endgroup\$
1
\$\begingroup\$

I'm working on the same thing, and the best options I've found are to either use imagemagick to split the images then import them to Xcode, or to import the master image and split it in code ...and optionally create a texture atlas, depending on how you prefer to keep track of which tile is which.

\$\endgroup\$
  • \$\begingroup\$ I ended up using a python script to cut it into pieces, but as of now this seems to be another shortcoming of SpriteKit tilemaps. Thank you for your response \$\endgroup\$ – Alec O'Connor May 23 '17 at 20:04
  • \$\begingroup\$ Since you were on the same type of project as I am, I will ask for your help, if you figure out how to make tiles of different size work in the same tilemap (i.e.: 64x32 floor tiles and 64x128 wall tiles) that would be awesome :-) \$\endgroup\$ – Jacob Johnson May 23 '17 at 20:06
  • \$\begingroup\$ You could make an extension on the different tile map types, but I wouldn't recommend straying from what most people are used to. You could also write your own tile map kit which I would recommend if you really want that \$\endgroup\$ – Alec O'Connor May 23 '17 at 20:42

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.