fubeca6 Posted August 12, 2015 Share Posted August 12, 2015 Hi all, Loaded a tilemap into phaser as json, exported from Tiled. It loads, I can see the tiles, the player can move on the map. However, once the player gets to a certain point on the map, I get this error: Uncaught TypeError: Cannot read property '2' of undefined which apperently references this line in phaser.min.js: set = this.map.tilesets[this.map.tiles[tile.index][2]]; This error occurs at different points on the map. I'm wondering if it's because the map is too large? It's 200x100 tiles (tiles are 32x32). I noticed that the coordinates of error, make a strait, diagonal line so that the top-right hand quarter of the map (about) is playable. I ensured that my tile image is correctly proportioned (it's 64x128) Also, I noticed some oddities (I think) in the exported json file: { "height":100, "layers":[ { "data":[4, 4, 4,....<doin' it's thing, and then...> ...2684354568, 2684354568, 1, 1, 1, 1, 1, 1, 1, 1, 5, 4, 4, 4, 7, 7, 2, 2, 7, 5, 5, 1, 1, 2684354568, 2684354568, 2684354568, 1,... Are those huge numbers to be expected? They definitely don't correspond to any tile indexes. I haven't noticed anything like that in any of my other Tiled maps. Any and all help is deeply appreciated! ThanksChad Link to comment Share on other sites More sharing options...
Preece Posted August 12, 2015 Share Posted August 12, 2015 I just resolved a problem that I believe may be the same one you are experiencing. New versions of Tiled include the possibility to use gzip or zlib compression on tile data in JSON exports. Phaser does not support this yet. To fix it, open your map in Tiled, go to "Map -> Map Properties". Then, in the properties box, look for Tile Layer Format. Switch this to CSV, and export your map. Should then work. Link to comment Share on other sites More sharing options...
fubeca6 Posted August 13, 2015 Author Share Posted August 13, 2015 Hi Preece, Thank you for the response. Unfortunately I am getting the same error (in fact, I had been using the CSV version all along). Out of curiosity, I tried using CSV, XML, and Base64 (uncompressed) and I got the error in every instance in the same spots. So, from what I understand, Phaser renders the tiles as they become visible to the camera - right? So there's got to be some clue to the issue based on where the issue is occurring - based on which tiles are 'trying' to be rendered? Thanks AllChad Link to comment Share on other sites More sharing options...
Recommended Posts