How to export colliders

Hello. I create colliders as objects to export them to JSON:

image

I can read collider positions and sizes from JSON:

         "name":"Colliders",
         "objects":[
                {
                 "class":"",
                 "height":32,
                 "id":1,
                 "name":"ground",
                 "rotation":0,
                 "visible":true,
                 "width":128,
                 "x":0,
                 "y":96
                }, 
                {
                 "class":"",
                 "height":32,
                 "id":2,
                 "name":"pipe",
                 "rotation":0,
                 "visible":true,
                 "width":32,
                 "x":16,
                 "y":64
                },

But I see that Tile Collision Editor exists. Maybe it can be more useful but I don’t know how to export colliders to JSON. I created a collider in this editor:

https://media.discordapp.net/attachments/524610627545595906/1079014388310229062/image.png

I added this object to a map:

https://media.discordapp.net/attachments/524610627545595906/1079015432532541490/image.png?width=403&height=406

But when I export it I don’t see these colliders. I see colliders that I added as objects:

{ "compressionlevel":-1,
 "height":8,
 "infinite":false,
 "layers":[
        {
         "data":[1, 2, 0, 0, 0, 0, 0, 0,
            1, 0, 0, 0, 0, 0, 0, 0,
            0, 0, 0, 0, 0, 0, 0, 0,
            0, 0, 0, 0, 0, 0, 2, 2,
            0, 265, 266, 0, 0, 0, 0, 0,
            0, 298, 299, 0, 0, 0, 0, 0,
            1, 1, 1, 1, 1, 1, 1, 1,
            1, 1, 1, 1, 1, 1, 1, 1],
         "height":8,
         "id":1,
         "name":"Tile Layer 1",
         "opacity":1,
         "type":"tilelayer",
         "visible":true,
         "width":8,
         "x":0,
         "y":0
        }, 
        {
         "draworder":"topdown",
         "id":2,
         "name":"Colliders",
         "objects":[
                {
                 "class":"",
                 "height":32,
                 "id":1,
                 "name":"ground",
                 "rotation":0,
                 "visible":true,
                 "width":128,
                 "x":0,
                 "y":96
                }, 
                {
                 "class":"",
                 "height":32,
                 "id":2,
                 "name":"pipe",
                 "rotation":0,
                 "visible":true,
                 "width":32,
                 "x":16,
                 "y":64
                }, 
                {
                 "class":"",
                 "height":16,
                 "id":3,
                 "name":"bricks",
                 "rotation":0,
                 "visible":true,
                 "width":32,
                 "x":96,
                 "y":48
                }],
         "opacity":1,
         "type":"objectgroup",
         "visible":true,
         "x":0,
         "y":0
        }],
 "nextlayerid":3,
 "nextobjectid":4,
 "orientation":"orthogonal",
 "renderorder":"right-down",
 "tiledversion":"1.9.2",
 "tileheight":16,
 "tilesets":[
        {
         "firstgid":1,
         "source":"..\/..\/..\/assets-dev\/tiled\/simple_mario_level.tsx"
        }, 
        {
         "columns":100,
         "firstgid":925,
         "image":"..\/..\/..\/..\/..\/..\/..\/Sprites\/Battle City\/BattleCitySpriteSheet_800x512.png",
         "imageheight":512,
         "imagewidth":800,
         "margin":0,
         "name":"tileset",
         "spacing":0,
         "tilecount":6400,
         "tileheight":8,
         "tilewidth":8
        }],
 "tilewidth":16,
 "type":"map",
 "version":"1.9",
 "width":8
}

The colliders are stored in the tileset. Since you know which tile is used at any given cell, you can get its collision data from the tileset.

2 Likes

Thank you very much!