I have used MapEditor for my choice of map creation with my particular TileMaps that i have made. I am making a side scroller game with Slick 2D and lwjgl. My question is this:
When exporting a created map VIA JSON, Usually it seems most map’s are shown as their tile id as shown in the snippet below which i have taken from the websites documentation and YES i do have json imported
{
"data":[1, 2, 1, 2, 3, 1, 3, 1, 2, 2, 3, 3, 4, 4, 4, 1], <------ Tile ID's
"height":4,
"name":"ground",
"opacity":1,
"properties":
{
"tileLayerProp":"1"
},
"type":"tilelayer",
"visible":true,
"width":4,
"x":0,
"y":0
}
however, when i check my own exported JSON map in the same fields i see,
{
"compression":"zlib",
"data":"eJzt1UFqwzAQQFFvus1Juizdldz\/ViULgQmWItmyJMtv4JGQBirNT9NlmXO+L2qEaXHP30K9u\/RWuq9SYR4rqenZ5+xdlOzrzHlsyJ2Wbe4yWz1KmoS5W4\/UmcLPfiKPsYm10CM9qTPlnDW231SPkiaP5T49UufKbbG1308tcpqs33eHHkfPFttvbouSHmc3GWGOnK9k53uabL1vth7PwjPG1GyRa7bvq9Biz\/TY\/8w9jrR4Te8Wo\/fY871TY2ZtcWQ\/Rz\/rtUaPcVq8z\/peV2wRdvp6\/Fs9XwqejzJndWjdY\/37QpOrTOwuM\/So3ST2v77WtGjQu0etJqFF7F5HptXfQ48WqZ3tbZJqUaNJyw6j9PjU5Cvyek6LVJP312LvuWOPvedocc9ZW\/T4rF2NHuNo3UKPsVrooccV9GqhR\/\/96zFui1F6tDhj7z2P2KPXeXvveOYepXfovd879gAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA4v4BxPaYbQ==",
"encoding":"base64",
"height":100,
"name":"solids",
"opacity":1,
"type":"tilelayer",
"visible":true,
"width":100,
"x":0,
"y":0
},
both of these are real samples, the first pulled from their documentation and the second from my raw export. As you can see the ‘data’ field of theirs differs from mine in that theirs is a JSONArray and as a result I believe this line of code,
for (int i = 0; i < amount; i++)
{
JSONObject layer = (JSONObject) layers.get(i);
solids = parse((JSONArray) layer.get("data"));
has been giving me problems. Is it because in the ‘data’ field of my map, i believe that is a JSONString and an encoded one at that and I am trying to cast it as an array?