This post is, once again, coming to you from Joraaver.
Last time, I talked about how the stages of our game are designed in Tiled, and what layers we had to look for. I also addressed leveraging the SAX parser in Java to parse the tmx file for the objects.
Today, I'm going to analyze how I stored my objects from Tiled and how I mapped them as tiles to jME's coordinate plane.
Most of the information regarding the "gid" number of the tile and collecting tilesheets is in the Parsing and Rendering TMX Files tutorial by GameDev Tuts+. I'll only be covering the things that are jME specific, and will touch base on the "gid" information if necessary.
Collecting the Objects
First, I'll quickly dive into collecting the tilesheets. Follwing the tutorial above, I created a nice and simple TileSet class, with the same attributes. Then, inside the DeafaultHandler I created, the code below handles grabbing each tileset and creating an instance for it:
public void startElement(String uri, String localName,String qName, Attributes
… Continue Reading