How do I load tilemap from JSON file? [SOLVED]

Get help using Construct 2

Post » Mon Feb 08, 2016 9:51 pm

Loading a standard tileset JSON is pretty simple, but how do you load a tileset JSON when it is optimized (Run-length encoding)?

Standard tileset JSON:
{"c2array":true,"size":[10,10,1],"data":[[[0],[0],[0],[0],[0]]]}

Optimized tileset JSON:
{"c2tilemap":true,"width":94,"height":94,"data":"22,21,7x22,21,96x22,24x47"}

Current way I'm loading the JSON:
Image

Scirra article on run-length encoding:
https://www.scirra.com/blog/ashley/3/te ... ap-tidbits
Last edited by jook00 on Mon Feb 08, 2016 11:36 pm, edited 1 time in total.
B
59
S
19
G
3
Posts: 451
Reputation: 6,339

Post » Mon Feb 08, 2016 11:04 pm

I'm guessing I can't load them into an array unless I parse them since the numbers have an x between the numbers?
B
59
S
19
G
3
Posts: 451
Reputation: 6,339

Post » Mon Feb 08, 2016 11:17 pm

and why exactly .. you need a array?

you can load tilemap directly....

Image
B
67
S
24
G
7
Posts: 1,518
Reputation: 11,072

Post » Mon Feb 08, 2016 11:36 pm

@korbaach Oh my gosh! That worked! Why was I trying to be so complicated? I think because everything I researched was talking about arrays. Thank you!
B
59
S
19
G
3
Posts: 451
Reputation: 6,339


Return to How do I....?

Who is online

Users browsing this forum: Yahoo [Bot] and 29 guests