Doubt about "tilesets/tiles/terrain"

watergrass

Greetings,

I try develop a code to know how work the option “terrain” in “tilesets/tiles/terrain”.

I create a simple MAP 8col x 6lin and use the watergrass.png, I can’t how say, but I mark the border’s image, how this:
watergrass_border

Save the map as .json, CSV, when I read the .json file I have this:

     "tiles":
        {
         "1":
            {
             "terrain":[0, 0, 0, -1]
            },
         "10":
            {
             "terrain":[0, 0, 0, 0]
            },
         "11":
            {
             "terrain":[0, -1, 0, -1]
            },
         "12":
            {
             "terrain":[-1, 0, -1, -1]
            },
         "13":
            {
             "terrain":[0, 0, -1, -1]
            },
         "14":
            {
             "terrain":[0, -1, -1, -1]
            },
         "15":
            {
             "terrain":[0, 0, 0, 0]
            },
         "16":
            {
             "terrain":[0, 0, 0, 0]
            },
         "17":
            {
             "terrain":[0, 0, 0, 0]
            },
         "2":
            {
             "terrain":[0, 0, -1, 0]
            },
         "4":
            {
             "terrain":[0, -1, 0, 0]
            },
         "5":
            {
             "terrain":[-1, 0, 0, 0]
            },
         "6":
            {
             "terrain":[-1, -1, -1, 0]
            },
         "7":
            {
             "terrain":[-1, -1, 0, 0]
            },
         "8":
            {
             "terrain":[-1, -1, 0, -1]
            },
         "9":
            {
             "terrain":[-1, 0, -1, 0]
            }
        },

Where is the “3” ???

The watergrass have 3col x 6lin = 18 tiles, I belive have 18 “terrain”, but have only 17!

This is the code: all2d_teste.json (2.8 KB)

Or the count not start in 1? The first element is 0?

Or 1 is the first element used?

Best regards

terrain

I understand now… The count is zero based!

The “3” element is not used, because is not marked on border.

I thinking “terrain” is great to define borders.

Mr. moderator, the topic is solved, perhaps it will be useful as knowledge.

1 Like

I’m happy to see you’ve found the answer yourself so quickly, and thanks for sharing it with us!

The Terrain Tool is indeed great for working with such a tile structure. For some other common structures, there is since recently (in the development snapshots) also support for Wang tiles.