Having trouble getting my sprite sheet to fit in the tile set in tiled

Hi I’m a newbie, just starting today in fact, I’m following a online course where I was told to download a sprite sheet, open it in tiled, but my tiles are not aligned with the tile set in tiled, so when I click on a tile it’s not coming out as a whole tile but in segments of the tile, which creates lines and gaps, can anyone help?

Samantha, when you created a new Tileset for your sheet, did you specify the tile width, height and spacing/margins to match what is in your sheet?

Assuming your sprite sheet is evenly spaced and consistent in sizes, this should overlay a “grid” on your sheet that matches where your tiles actually are (no gaps/no clips).
Note: I have found I sometimes need to externally edit (PhotoShop or Paint) the Tileset images to ensure the images I want to use as tiles are evenly spaced, etc. Tiled simply puts a uniform grid down based on the above settings then you create a new Tileset.
Note also: To my knowledge, once you create a New Tileset, if those settings in the image above are not correctly matching your sheet, you cannot change them inside Tiled. Instead, trash the New Tileset, adjust those settings to properly match your image sheet, and try again until the Tileset grid lands where you want it.

1 Like

Hi Remusforte, Thanks for your response, As I am new to all of this, I found myself following others, I don’t think the sprite sheet was correct, I then later received the correct sprite sheet which solve this error.
But for the future, how would you know what size tiles your using to be able to fit nicely into the tile set, I know some one said by the pixels, but say that your using photo shop, how would you know,

Hi Samantha - I simply open the graphic image in either PS or Paint, zoom way in, and look at the pixels in detail. In PS, there is a tool which will tell you the size of a selected area: simply use the Rectangle Select tool, box in the desired tile, and open the “Info sub-window”; it tells you the pixel dimensions of the box. Or you can use the tried-and-true method of manually counting them. :slightly_smiling:

I find the tricky thing in Tiled is that it sets up a “fixed grid” based on the pixel dimensions as shown in my attached graphic above. So you need to take some care to be sure your desired tiles in your image sheet have those same fixed dimensions/spacing, or you will get cut-offs/clips of some of them.

My trick, FWW, when my tiles don’t match size so well: I open a new file in PS with no background. I copy the tile I want out of the original image. If it is the right size, I paste it into my empty new sheet. If it is NOT the right size, I paste it into a “temp image” sheet, then resize it (PS tools) to the desired pixel size, and then paste it (correct size now) in my new image sheet. I repeat for all of the tiles I want to use in my map, each time being VERY careful to paste the new tile exactly 1 pixel away from the others. When done, I have a precise, fixed grid of tiles, such as this one:

When I create a new Tileset, I simply enter the pixel dimension of each tile (hexes in this example, and they are all the same), and set the margin = 1 (around the edge of the sheet) and spacing = 1 (which you can see in this image). Works like a charm.

If you are lucky, your sheet will already be consistent in tiles sizes…and you won’t need to go through all of that extra effort. :slightly_smiling:

Thanks @Remusforte for helping out!

Small correction: since Tiled 0.15, you can change tileset settings after adding the tileset. There’s a button for this in the Properties view, after opening the tileset properties with the small icon below the tileset view.

1 Like

Ooo… that’s great! :slightly_smiling:
I just pulled in 0.15 and had not stumbled on that feature yet. Very hand!
Thanks!

1 Like