Take the 2-minute tour ×
Game Development Stack Exchange is a question and answer site for professional and independent game developers. It's 100% free, no registration required.

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.

Thanks!

share|improve this question

1 Answer 1

up vote 3 down vote accepted

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.

share|improve this answer
    
Yeah I missed that. Thanks a bunch! –  Mayank Jul 19 '12 at 17:42

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

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