How do I programatically extract tiles from a tileset such as this one: http://opengameart.org/sites/default/files/grassland_tiles.png

I want to use these tiles in my game. I see that some tiles here are of different sizes (or maybe all tiles are a multiple of some fixed size). For example, if I want to use one of the tree tiles in my program, how can I figure out what offset into the tileset image I must use, and how big of a sub-image i must extract? I don't see any metadata associated with any of these tilesets that I can use.



You generally need some text file or other metadata to describe the contents of a texture atlas like this.

I suspect you went here: http://opengameart.org/content/grassland-tileset to get this URL? (That would've been handy in your OP.)

If so, you must've missed this note:

To use the tile set in Tiled v0.8, get the necessary files from the Flare git repo.

The git repo is: https://github.com/clintbellanger/flare/tree/master/tiled/grassland

Its got one .txt several .tmx files. The .tmx files seem to describe the location of specific items in the atlases.

| improve this answer | |

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.