Change y-sort value of a tilemap

:information_source: Attention Topic was automatically imported from the old Question2Answer platform.
:bust_in_silhouette: Asked By godotNewbie
:warning: Old Version Published before Godot 3 was released.

I want to control how high or low my sprites would go, before hiding behind or appearing in front of other sprites (y-sort). Upon observation, I think that this is controlled by the “tile origin”, because altering this changes the way that y-sort works.

Is there any way to do this? Thanks!

I have this problem, too.

BIGbirddy | 2018-04-13 09:11

:bust_in_silhouette: Reply From: BIGbirddy

Actually I found the solution in which the official demo has shown.
1.You simply set the offset of each tile object (a sprite) to proper position.
(I suggest set to its central point of the ground plane)
2.And then set tile-origin to “center” in your tilemap node. So that your tile brush
will align to the tile.

The tile position isn’t changed though, but we “offset” the sprite already.
So the sprite will be render at the upper-left of its tile position.
As a result, the “y-value” in y-sort of that tile is visually correct.

Example

This is a side wall from my work (in case you can’t tell…)
Illustration

So we need to set the offset of the sprite to (-35, -345), which makes the new origin
to (35, 345).
work-flow
Notice that Godot also set a new pivot after you change offset.
Here is my quick demo:
Fix render order