Hello all,
So, I’ve created a pretty simple 37x27 tile map, and I’ve exported it to a JSON file. Using the JSON Map Format, I’ve been able to parse it quite easily.
However, there is one bit that is confusing me, and I understand this question has been asked in different forms, but I haven’t seen an answer that truly makes me understand.
First off, since I’m a new user, so I was not able to upload my JSON file, so for now, I have to use this: http://s000.tinyupload.com/?file_id=97771536151311218352
So the general flow of my the deserializer is:
- Get the
data
array of GID’s from thelayer
, “Tile Layer 1” (which are presumably in order). - Get a reference to the
tileproperties
from thetileset
, “plains” - Iterate over the
data
array and use each value as the key for thetileproperties
dictionary. My assumption here is that the key is the tile ID it refers to
And this is where I run into problems. There is a tile ID = 50 in data
, but that key does not exist in tileproperties
. In fact, there is no tile with that ID in the editor at all. For whatever reason, the ID’s for my tiles goes from 49 and then skips to 52. shrugs
Now, I understand about firstgid
(or at least I think I do). I was thinking it acted as an offset of sorts. For instance, I have a layer
named “Units”. I also have a tileset
called “units”. Under tileproperties
, the ID’s go from 0 - 4, but then firstgid
= 65, so if I add 65 to each of those ID’s, that maps directly to the IDs in the data
array for the “Units” layer
.
This, unfortunately does not work for the “Tile Layer 1” layer
, so I’m at an impasse.
Sorry for the lenghy post, I just figured I would add as much information as possible so my issues are properly understood.
Thanks in advance to anyone who can answer these questions for me.
Regards,
Leonard Bedner