Problem Description
Tilemap.TilesJSON is not updating properly when changing size and filling it with tiles.
Attach a Capx
https://dl.dropboxusercontent.com/u/343 ... pJSON.capx
Description of Capx
3 buttons to change the width of the Tilemap and fill it with random tiles. and TextArea filling returned values from expression every tick.
Steps to Reproduce Bug
- Click on + or - buttons
- Click on Fill button
- Watch TextArea
- Click again on + or - buttons
- Click on Fill button
- Watch TextArea
Observed Result
Tilemap.TilesJSON expression return values only if you change tiles on the tilemap (clicking on the Fill button) and not while changing objects size.
Also when you increase objects width from default 8 (tiles not pixels) to something different like 10 and click Fill, You will notice that Tilemap.TilesJSON have updated properly - width, and all tiles numbers and states. But if you then decrease width from 10 to something less like 7 or 4, Tilemap.TilesJSON will only update tile numbers and states. In the TextArea "width" won't change and also number of tiles won't change. It will keep the numbers from before making Tilemap smaller.
Expected Result
Every change to the object should be correctly returned using Tilemap.TilesJSON expression - "width", "height", "data"
I can only guess, but I think it's doing that because it keep tile IDs in the object and only clamping their visibility when changing size of the Tilemap - You can observe that after: make it bigger, hit Fill, make it smaller, hit Fill, and make it bigger again. After last step you should not see anything, empty new spaces for tiles but instead there are already tiles present there.
Edit: This makes making your own Level editor impossible. Because what you see on the screen is very different from what you will save in file :/
Edit2: Also Tilemap.AsJSON expression behaves same way. When you fill entire Tilemap with Tiles and then make Tilemap smaller both .AsJSON and .TilesJSON will remember the tiles placed outside of the "visible tilemap size". Which make files bigger and filled with stuff you will never need or see after loading a json file from HDD.
Operating System and Service Pack
Win 8.1 64
Construct 2 Version ID
R207