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.

I have used tilemaps .TMX files using cocos2d and objective c.

How are tilemaps used in C? Are there libraries available or where is a good place to start for using tilemaps in C?

I would like to create a tilemap using a tool. if this is supported by a library in C and then read each tiles layer.

How is this done in C?

share|improve this question
    
It's done in C the same way it's done in any other language. If there isn't a good library you can write one yourself. The fundamentals are the same. –  Tetrad Mar 25 '11 at 14:38

1 Answer 1

up vote 2 down vote accepted

I've used "Tiled Map Editor" http://www.mapeditor.org/ for a iPhone game with good results. Our engine was made in house, but Tiled has his own format file that you can parse easily or you can append a custom format.

Tile supports layer, metaobjects to place the positions of objects in the game or anything else. It's multiplatform and free.

You provide an image with all tiles. Each tile is represented by a number. When you draw the map in the editor, the output is a matrix with the numbers that represents the tiles, with this identifiers you can put the tiles in your game in the correct order.

share|improve this answer
    
Are you describing how to use it for an iphone game(objective C)? I am asking about using C. –  Helium3 Mar 25 '11 at 14:36
    
I'm describing the generic form. I used it with C++, but it is perfectly valid to C. You have to use the file read functions of C/C++ and parse the file that Tiled generates. For C: go4expert.com/forums/showthread.php?t=2977, for C++: cplusplus.com/doc/tutorial/files –  momboco Mar 25 '11 at 14:45

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.