Y sorting applies to singular tiles

Godot Version

4.something

Question

Hey there!

I’ve been trying to figure out the y-sorting feature for my game’s set dressing. Tbh, it’s never worked straight-forwardly for me. It’s never as smooth as in the tutorials no matter what. I always do parent node with y-sorting enabled > CharacterBody2D as child & TileMap (recently attemped TileMapLayer) also as child. Nothing.

I believe I finally got the character to faze through eventually, but with two caveats:

  1. the y-sorting I set (anywhere!) doesn’t seem to have an effect on where the character actually disappears/appears
  2. the y-sorting seems to be rendered with consideration to the singular tiles the import splits the pixel art into:

Respectfully, if someone could tell me why the heck it’s doing this and how I fix it, i would be very grateful!


YSorting is a brutality that has just recently beat me up as well.
In any case:
There is a y sort origin point on the tile map tile. If that point is above the origin point of your character then it will be behind your sprite.
Your character sprite should be situated such that 0,0 is at its feet.
Then you can adjust each tile ysort origin if necessary by selecting the tileset, select the individual tile, and then under “rendering” you will see ysort origin.

Don’t use TIleMap nodes anymore. I wish that node would just disappear so that everyone is on the same page.

There is a decent example of ysorting in this episode of a tutorial.