TileMap JSON Explanation

Discussion and feedback on Construct 2

Post » Mon Jun 15, 2015 12:27 am

Can someone explain/breakdown what you see when you get the tilemap.AsJSON?

Sample: {"c2tilemap":true,"width":4,"height":4,"data":"0,4x-1,1,3x-1,2,6x-1"}

I'm thinking of writing a converter for my project.
Follow me on Twitter @evgLabs
B
34
S
14
G
4
Posts: 251
Reputation: 4,074

Post » Mon Jun 15, 2015 2:00 am

Follow me on Twitter @evgLabs
B
34
S
14
G
4
Posts: 251
Reputation: 4,074

Post » Mon Jun 15, 2015 5:53 am

What kind of converter?
I've already worked intensively with the topic.
Because I have written a json converter for Tiled to Construct.
So if you have any questions...
Sorry for my bad english, but I really do my best! And use and check with Google Translator.
B
10
S
4
G
1
Posts: 158
Reputation: 1,303

Post » Mon Jun 15, 2015 3:08 pm

I'm going to have about one hundred ~6 color PNGs that I can convert to TXT files with ImageMagik, giving me something like this:

Code: Select all
# ImageMagick pixel enumeration: 54,30,255,srgba
14,0: (255,255,255,0)  #FFFFFF00  srgba(255,255,255,0)
15,0: (255,255,255,0)  #FFFFFF00  srgba(255,255,255,0)
16,0: (255,255,255,0)  #FFFFFF00  srgba(255,255,255,0)
17,0: (255,0,255,1)  #FF00FF  magenta
18,0: (255,0,255,1)  #FF00FF  magenta
19,0: (255,0,255,1)  #FF00FF  magenta


So I can take these outputs and convert them to a tilemap based on the pixel color.
Follow me on Twitter @evgLabs
B
34
S
14
G
4
Posts: 251
Reputation: 4,074

Post » Mon Jun 15, 2015 6:49 pm

How would you like specify what color, what tile index?
By hand, entry in a list?
Sorry for my bad english, but I really do my best! And use and check with Google Translator.
B
10
S
4
G
1
Posts: 158
Reputation: 1,303

Post » Mon Jun 15, 2015 7:08 pm

I use a dictionary so if the token at X = (255,255,255,0) then the tile is -1, (255,0,255,1) = 1, so forth. I actually have it made now I guess I can upload the capx later.
Follow me on Twitter @evgLabs
B
34
S
14
G
4
Posts: 251
Reputation: 4,074

Post » Mon Jun 15, 2015 7:11 pm

Ahh you make it in construct...
I thinked you mean a Windows Application, to convert text file to json tileMap file and finaly want to import the json file in Construct.
My misstake.
Sorry for my bad english, but I really do my best! And use and check with Google Translator.
B
10
S
4
G
1
Posts: 158
Reputation: 1,303

Post » Mon Jun 15, 2015 7:15 pm

Well, yeah that's what it'll do. Take a folder of txt files that are a list of the pixel and their colors. And convert each txt file to a tilemap JSON then save each as a key in a master dictionary. Then I can take THAT dictionary.AsJSON put it in my game, a set the tile map to "hull1", or "hull2"
Follow me on Twitter @evgLabs
B
34
S
14
G
4
Posts: 251
Reputation: 4,074


Return to Construct 2 General

Who is online

Users browsing this forum: 99Instances2Go, Garrey, grym57, RoboticPhoenix, The Mnk and 2 guests