TMX Tile Maps

Elliot Franford
This is my implementation of maps from the Tiled application into Sparrow
tilemap, tiled


Hi everyone, First and foremost thank you for checking out my first sparrow extension! I wanted to inform you all that this project has been a learning experience. This is my first time working in objective-c, Sparrow, and Tiled. My code may not be the best implementation at points and there are some known issues that I am working on getting through. Please help me make this a great extension and help make me a better engineer by providing feedback and constructive criticism.

Thank you all, and without further ado…


You should be able to grab all the code files with the TMX prefix and add in the headers to your sparrow.h or just copy the one in the Classes directory.

To create a TileMap simply create one using Tiled and make sure to set the export to CSV. I will be adding in the other types later on, but for now I was looking at something quick to get it in there.

TMXMap* map = [[TMXMap alloc] initWithContentsOfFile:@"mymapname.tmx" width:width height:height];
[self addChild: map];


  1. Grab the example from github and then open it up in XCode.
  2. Next, crack open tiled and then open the “map.tmx” from inside the example folder.
  3. Take a look at the map, I have object layers as well as some physics polygons

(it should look like)

  1. Add whatever you want to the map and save
  2. Make sure you have it saving as a CSV
  3. Go back into XCode and then launch the example
  4. From there you should be able to launch it and see the following


  • 2012/02/23 03:16: First public version (Be gentle!!)
  • 2012/03/01 18:23: Updated with latest screenshots and responses - fixed gridlines & framerate

!!Known Issues!!

  • Map may be inverted in different layouts


If you get the inverted map try the BEScreen

The way my sample has the map in it is like this

  BEScreen mScreen = [BEScreen screenWithOrientation:BEScreenOrientationLandscapeRight rotates:YES allowAllOrientations:NO];
  TMXMap* map = [[TMXMap alloc]initWithContentsOfFile:@"mymapname.tmx" width:width height:height];
  [mScreen addChild:map];
  [self addChild:mScreen];

Source Code

I figured there were a bunch of code files and that a gist might not be the right format. You can check out the github project here.


Good: very easy to include in your project and use Bad: Slows the system down really badly (10fps max), grid lines

Hopefully this extension will not be forgotten about, it just needs a little work!

Response (Elliot)

Hi there, I fixed the gridline issue and also put in some framerate metrics. It seems as though I am getting a full 30/30 FPS. Could you please link me what you were trying to do so I can try to identify the problem areas? Thanks, Elliot

  extensions/tmxtilemaps.txt · Last modified: 2015/09/14 11:14 by
Powered by DokuWiki