Is it possible to make the tiles origin start in the upper left?

I made a map with tiled of size 15x15 pixels. But the yellow enemy sphere thingie is 30x30 pixels. In computer graphics the origin is the upper left corner of the screen. The upper left tile in the map is 0,0 in the CSV but the enemy tile grows like its origin is in the bottom left corner of the tile.

This is the enemy at the tile y:0 x:0

This is the enemy at the tile y:1 x:0

I think y:0 x:0 should look like y:1 x:0. It is not much work to make a workaround in the code that loads the map, but I think this is unintuitive because computer graphics have always had the upper left corner as the origin. Is there an option to make the tiles “grow” downwards?

The reason I picked bottom as opposed to top alignment for tiles larger than the grid is because this feature is often used for tiles that are meant to overlap with the tiles above it. Take for example the “isometric grass and water” example map shipping with Tiled, where the grass sticks out at the top and will naturally be drawn on top of the tiles of the previously drawn row.

For similar reasons, tile objects, placed on object layers, were also bottom-left aligned. But since this inconsistency with the plain rectangle objects caused much confusion and frustration, we’ve recently introduced an “object alignment” option on the tileset, with which you can change this to top-left for example.

However, this new option only applies to tile objects at the moment, whereas tiles on a tile layer still draw the same way (bottom-left aligned). I wasn’t sure whether we should support the feature there as well, but I think it makes sense to have it affect both cases.

That is logical. But if I could set it in each layer I would be convenient. So the “enemy-layer” got the sprite’s origins in upper left. Then I could use the enemy sprites as-is in the map editor.

I think the tile alignment is more often tied to the graphics than the layer. Suppose you had multiple maps, you’d need to set top-left alignment on the enemy layer on each of those maps, as opposed to setting it up once for the tileset containing your enemy sprite.

1 Like

Sorry to revive and steal this old topic, but this quote regarding the Object Alignment property on tilesets explains exactly my problem.

However, this new option only applies to tile objects at the moment, whereas tiles on a tile layer still draw the same way (bottom-left aligned). I wasn’t sure whether we should support the feature there as well, but I think it makes sense to have it affect both cases.

Is this still being considered? I am new to the Tiled editor and am creating a tilemap using a 8x8 tileset (with 1 pixel overhang on each side, so actually 10x10) and changing the tileset’s object alignment to center has no effect when adding tiles to a layer in the map. I initially thought this was a bug, but it seems it’s a design choice? If so, how am I supposed to create a tilemap using tilesets with overhang on all sides?

Such an option can still be considered, but you don’t need it for your use-case. If all your tiles are 10x10 and used on an 8x8 grid, the way to make them overhang by 1 pixel on all sides is to set the Drawing Offset of the tileset to (-1, 1).

(essentially, as long as all your tiles are the same size and always used on a grid of a certain size, the Drawing Offset option can do the same thing as such an alignment option would do)

@bjorn Shouldn’t that offset be (-1, -1) to push the tiles a pixel up and left? Or do I misunderstand how Tiled’s coordinates work?

Out of curiosity, @regen, what is the 1px overhang for? It’s rather unusual to see tiles like this, so I’m curious what the usecase is :D

On the off-chance that it’s just extruded tile edges, you can have Tiled ignore those entirely for rendering, by setting your tileset to have 8x8 tiles with 1px margins and 2px spacing (plus any extra transparent spacing your tileset may have).

That’s just because in Tiled, the tiles on tile layers are aligned to the bottom-left (which is also why tile objects were aligned to the bottom-left, until an option to change this was introduced on the tileset). So without changing the drawing offset, an 10x10 tile on a 8x8 grid will stick out 2 pixels at the top and the right side. Hence the (-1,1) offset makes it extrude 1 pixels on all sides.

1 Like

Right, I always forget that :'D Thanks for explaining (again)!

Thank you so much! Setting drawing offset did the trick.

@eishiya I am using this tileset, and if you look at the ice platforms, there’s an overhang of 1 px to the left or right, and sometimes bottom as well.

I am not sure what you mean by extruded tile edges, as I’m entirely new to tile editors. I’m guessing this would be a part of a tile that I’d want removed?

Oh, interesting! Usually I see overhangs implemented as additional tiles, this is neat.

Extruded edges are when the edge pixels of a tile are repeated. This helps avoid some rendering issues that can happen when the tiles are drawn on a subpixel rather than aligned perfectly to the pixel grid, it’s mostly relevant for low-res pixel art games. Many engines have rendering code that avoids the need for this, or does it under the hood for you, so it’s rare to see extruded edges included as part of the tileset, it’s usually something developers apply on their own if they see that they need it.
When you do have tiles with extruded edges, you typically don’t want to see those edges while designing your map, so you’d want those hidden in Tiled, which you’d achieve by setting the margins and spacing such that the edges end up in the space between tiles.