Tilemap: Tilemap.TilesJSON not updating properly

Bugs will be moved here once resolved.

Post » Tue Jun 16, 2015 7:42 pm

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
ImageImageImageImage
B
157
S
66
G
42
Posts: 2,603
Reputation: 35,343

Post » Fri Jun 19, 2015 2:07 pm

Thanks, should be fixed in the next beta.
Scirra Founder
B
398
S
236
G
88
Posts: 24,428
Reputation: 194,600

Post » Fri Jun 19, 2015 2:20 pm

Lifesaver! Thank you.
ImageImageImageImage
B
157
S
66
G
42
Posts: 2,603
Reputation: 35,343


Return to Closed bugs

Who is online

Users browsing this forum: No registered users and 3 guests