Differences

This shows you the differences between two versions of the page.

Link to this comparison view

Both sides previous revisionPrevious revision
Next revision
Previous revision
extensions:tmxtilemaps [2012/03/02 00:26] – [Response (Elliot)] 76.24.142.138extensions:tmxtilemaps [2015/09/14 11:14] (current) – external edit 127.0.0.1
Line 1: Line 1:
 +~~NOTOC~~
  
 +====== TMX Tile Maps ======
 +
 +---- dataentry extension ----
 +type          : extension  # or 'mod' if it requires changing the Sparrow source 
 +author_mail   : elliot.franford@gmail.com Elliot Franford 
 +description   : This is my implementation of maps from the Tiled application into Sparrow
 +lastupdate_dt : 2012-02-22
 +compatible    : v1.2
 +depends       :            # if the ext. depends on others, list them here
 +tags          : tilemap, tiled
 +homepage_url  : https://github.com/efranford/SparrowTileMaps
 +download_url  : https://github.com/efranford/SparrowTileMaps/zipball/master
 +----
 +
 +===== Disclaimer =====
 +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...
 +
 +
 +===== Usage =====
 +
 +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 [[http://www.mapeditor.org|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.
 +
 +<code objc>
 +TMXMap* map = [[TMXMap alloc] initWithContentsOfFile:@"mymapname.tmx" width:width height:height];
 +[self addChild: map];
 +</code>
 +
 +===== Example =====
 +  - Grab the example from [[https://github.com/efranford/SparrowTileMaps/tree/master/example|github]] and then open it up in XCode.  
 +  - Next, crack open tiled and then open the "map.tmx" from inside the example folder.
 +  - Take a look at the map, I have object layers as well as some physics polygons
 +
 +(it should look like)
 +
 +{{ http://img703.imageshack.us/img703/8619/tiledmap.png?300 |}}
 +
 +  - Add whatever you want to the map and save
 +  - Make sure you have it saving as a CSV
 +  - Go back into XCode and then launch the example
 +  - From there you should be able to launch it and see the following
 +
 +{{ http://img43.imageshack.us/img43/6552/gridlinesfixed.png |}}
 +===== Changelog =====
 +
 +  * //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
 +
 +
 +====== Workarounds =====
 + If you get the inverted map try the [[http://wiki.sparrow-     
 + framework.org/extensions/be_screen|BEScreen]]
 +
 +The way my sample has the map in it is like this
 +<code objc>
 +  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];
 +</code>
 +===== 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 [[https://github.com/efranford/SparrowTileMaps|here]].
 +
 +===== Discussion =====
 +
 +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?
 +{{ http://img594.imageshack.us/img594/3884/fpsresponse.png |}}
 +Thanks,
 + Elliot
 
 
Powered by DokuWiki