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.
Check out my games on Google Play:

BEAST ATTACK (960,000+ downloads!)

ZOMBIE BASH (Android) (Launched Feb 17)

ZOMBIE BASH (iOS) (Launched March 17)
B
50
S
15
G
2
Posts: 427
Reputation: 5,164

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?
Check out my games on Google Play:

BEAST ATTACK (960,000+ downloads!)

ZOMBIE BASH (Android) (Launched Feb 17)

ZOMBIE BASH (iOS) (Launched March 17)
B
50
S
15
G
2
Posts: 427
Reputation: 5,164

Post » Mon Feb 08, 2016 11:17 pm

and why exactly .. you need a array?

you can load tilemap directly....

Image
Image
B
63
S
23
G
7
Posts: 1,475
Reputation: 10,776

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!
Check out my games on Google Play:

BEAST ATTACK (960,000+ downloads!)

ZOMBIE BASH (Android) (Launched Feb 17)

ZOMBIE BASH (iOS) (Launched March 17)
B
50
S
15
G
2
Posts: 427
Reputation: 5,164


Return to How do I....?

Who is online

Users browsing this forum: ColombageEnPLS and 2 guests