tileAt returns incorrect value for a tile after loading json string.
Attach a Capx
Description of Capx
A tilemap has tiles predrawn. At start of layout it loads a json string into the tilemap, which changes some of the tiles.
Steps to Reproduce Bug
The tiles that weren't changed now return -1 when using tileAt expression.
tileAt should return the correct value for all the tiles.
Operating System and Service Pack
win vista sp2
Construct 2 Version ID
Also, here's a suggestion. Why not add some offset values to load the tiles at a position other than 0, 0.
Develop games in your browser. Powerful, performant & highly capable.
Closing as not a bug: your JSON string has the incorrect size in it (the width and height properties are 10 and 11). If I save TilesJSON again it has the correct size of 53x30. Some previous releases had bugs with saving the wrong JSON data, which should be fixed now, I think this is just a consequence of that.
Eh.. but the collisions are still there for the parts that aren't updated.
Ashley , If you want to limit the use of the tilemap, you should force it to resize itself to avoid confusion. There is however the possibility that someone would want to update only a section of the tilemap- I don't think you should disregard that. This is an opportunity to make your product better.
It's mainly just odd that the tiles outside of the updated area remain visible, as well as their collisions- so why not their tile number be accessible as well? It just seems like an oversight. Something just isn't right with it. I also don't think it is good to just assume nobody will ever update just part of the tileset and expect the rest to go unused- that sort of thinking limits creativity.
edit: I guess I could make a plugin that loads in a section with offsets, etc.. I think I'll do that for now.
Everything should work if you save valid JSON data. The problem stems from the fact you are using invalid JSON data, probably saved with an old build that had a bug.