myheadasplode Posted May 22, 2014 Share Posted May 22, 2014 Hi guys, I exported a JSON tilemap from Tiled and loaded it into Phaser. It works perfectly except that my map loads up the wrong tiles - the tiles loaded have an index one greater than the ones I want (I hope that makes sense). Here's my code: preload: game.load.tilemap('map', '../Assets/map.json', null, Phaser.Tilemap.TILED_JSON); game.load.image('level', '../Assets/tiles.bmp') create: map = game.add.tilemap('map'); map.addTilesetImage('level'); layer = map.createLayer('Tile Layer 1'); and here's the JSON:{ "height":20, "layers":[ { "data":[1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 10, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 10, 1, 1, 1, 1, 1, 1, 1, 10, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 10, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 10, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 10, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 10, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1], "height":20, "name":"Tile Layer 1", "opacity":1, "type":"tilelayer", "visible":true, "width":20, "x":0, "y":0 }], "orientation":"orthogonal", "properties": { }, "tileheight":32, "tilesets":[ { "firstgid":0, "image":"tiles.bmp", "imageheight":512, "imagewidth":224, "margin":0, "name":"tiles", "properties": { }, "spacing":0, "tileheight":32, "tilewidth":32 }], "tilewidth":32, "version":1, "width":20}I took the data array and decreased each number by 1 (so it came out as 0, 0, 0, 9, 0 0, etc), but that didn't solve the problem. Does anyone have any ideas? Link to comment Share on other sites More sharing options...
rich Posted May 22, 2014 Share Posted May 22, 2014 Here this post will help: http://www.html5gamedevs.com/topic/5668-tiled-json-possible-bug/#entry34406 Link to comment Share on other sites More sharing options...
valueerror Posted May 22, 2014 Share Posted May 22, 2014 this... or you changed something on the tileset image and have to delete the browser cache ^^ ;-) Link to comment Share on other sites More sharing options...
myheadasplode Posted May 24, 2014 Author Share Posted May 24, 2014 Thank you guys! Link to comment Share on other sites More sharing options...
Recommended Posts