Custom tileset problems

Im getting a weird error when trying to load my own tileset.

The numbers are divisible by 32 but im still getting an error

I have included the tileset image as well

this tileset loads up perfect in tiled with margin 1 and spacing 2

The error message references a 256 x 512 image…I don’t think those are your image dimensions.

At 32x32, a  256 x 512  tile map would be  8 * 16 tiles.

It looks like you have 7 * 10 tiles?  

I Haven’t used MTE, so I’m not sure what needs to be changed.

The size of the image must be divisible by the actual size of the tiles in that image. In this case your 32x32 tiles are extruded by 1 pixel on every side, so they are actually 34x34 pixels and the tileset size must be divisible by 34. Try cropping your tileset to 238 x 510.

On an unrelated note, the first four columns of tiles in your image appear to be shifted two pixels upward from where they should be. This will not prevent the tileset from loading and running, but it may adversely affect the appearance.

hey dyson

I put in the tileset image you fixed and the tileset part of the map file looks like this

[lua]

 “tileheight”:34,

 “tilesets”:[

        {

         “firstgid”:1,

         “image”:“assets/tilesets/tiles.png”,

         “imageheight”:512,

         “imagewidth”:256,

         “margin”:1,

         “name”:“tiles”,

         “properties”:

            {

            },

         “spacing”:2,

         “tileheight”:34,

         “tilewidth”:34

        }],

 “tilewidth”:34,

 “version”:1,

 “width”:40

}

[/lua]

[lua]

 “tileheight”:32,

 “tilesets”:[

        {

         “firstgid”:1,

         “image”:“assets/tilesets/tiles.png”,

         “imageheight”:512,

         “imagewidth”:256,

         “margin”:0,

         “name”:“tiles”,

         “properties”:

            {

            },

         “spacing”:2,

         “tileheight”:32,

         “tilewidth”:32

        }],

 “tilewidth”:32,

 “version”:1,

 “width”:40

}

[/lua]

Still having a weird graphical glitch… attached a pic below… what exactly needs to be changed to get it perfect?

At least it’s running!

Logically the tiles are considered to be 32 x 32. I know this can get confusing, but as far as Corona and Tiled are concerned, the tiles are 32 x 32. You need a margin of 1 and a spacing of 2. The imageHeight and imageWidth should match the size of the new image.

"tileheight":32, "tilesets":[{ "firstgid":1, "image":"assets/tilesets/tiles.png", "imageheight":510, "imagewidth":238, "margin":1, "name":"tiles", "properties": { }, "spacing":2, "tileheight":32, "tilewidth":32 }], "tilewidth":32, "version":1, "width":40 }

.

edit: working beautifully :smiley: thanks so much dyson

PS could you remove my tileset now? thanks

This will probably boil down to some subtle error in the code we just exchanged. 

If you could email your entire project to me I can dig into it and figure out just what isn’t working. My email address is ----.

EDIT: I see that it is working now. Glad to help! Let me know if any other issues come up.

The error message references a 256 x 512 image…I don’t think those are your image dimensions.

At 32x32, a  256 x 512  tile map would be  8 * 16 tiles.

It looks like you have 7 * 10 tiles?  

I Haven’t used MTE, so I’m not sure what needs to be changed.

The size of the image must be divisible by the actual size of the tiles in that image. In this case your 32x32 tiles are extruded by 1 pixel on every side, so they are actually 34x34 pixels and the tileset size must be divisible by 34. Try cropping your tileset to 238 x 510.

On an unrelated note, the first four columns of tiles in your image appear to be shifted two pixels upward from where they should be. This will not prevent the tileset from loading and running, but it may adversely affect the appearance.

hey dyson

I put in the tileset image you fixed and the tileset part of the map file looks like this

[lua]

 “tileheight”:34,

 “tilesets”:[

        {

         “firstgid”:1,

         “image”:“assets/tilesets/tiles.png”,

         “imageheight”:512,

         “imagewidth”:256,

         “margin”:1,

         “name”:“tiles”,

         “properties”:

            {

            },

         “spacing”:2,

         “tileheight”:34,

         “tilewidth”:34

        }],

 “tilewidth”:34,

 “version”:1,

 “width”:40

}

[/lua]

[lua]

 “tileheight”:32,

 “tilesets”:[

        {

         “firstgid”:1,

         “image”:“assets/tilesets/tiles.png”,

         “imageheight”:512,

         “imagewidth”:256,

         “margin”:0,

         “name”:“tiles”,

         “properties”:

            {

            },

         “spacing”:2,

         “tileheight”:32,

         “tilewidth”:32

        }],

 “tilewidth”:32,

 “version”:1,

 “width”:40

}

[/lua]

Still having a weird graphical glitch… attached a pic below… what exactly needs to be changed to get it perfect?

At least it’s running!

Logically the tiles are considered to be 32 x 32. I know this can get confusing, but as far as Corona and Tiled are concerned, the tiles are 32 x 32. You need a margin of 1 and a spacing of 2. The imageHeight and imageWidth should match the size of the new image.

"tileheight":32, "tilesets":[{ "firstgid":1, "image":"assets/tilesets/tiles.png", "imageheight":510, "imagewidth":238, "margin":1, "name":"tiles", "properties": { }, "spacing":2, "tileheight":32, "tilewidth":32 }], "tilewidth":32, "version":1, "width":40 }

.

edit: working beautifully :smiley: thanks so much dyson

PS could you remove my tileset now? thanks

This will probably boil down to some subtle error in the code we just exchanged. 

If you could email your entire project to me I can dig into it and figure out just what isn’t working. My email address is ----.

EDIT: I see that it is working now. Glad to help! Let me know if any other issues come up.