Skip to main content
put tall item comment into the answer
Source Link
idbrii
  • 987
  • 6
  • 21

Customizing Draw Order

According to this issue, there is currently no support in Godot for customizing the draw order how you want, but there are some workarounds:

  1. Manually sort your tiles. "TileMaps currently break ties by rendering the oldest tiles first" so you can change the draw order by creating tiles in your intended order.

  2. "changing the second value in the TileMap's cell_custom_transform to a very small number like 0.01 so tiles are rendered from left to right."

This is because the tiles on the left have an indiscernibly smaller y value. This could be changed to -0.01 to render from right to left.

This does mean that your tiles won't be perfectly horizontally aligned, and will drift by a pixel every 100 tiles. But, this small amount of drift may be preferable to the blinking of the xsort() function I provided.

Controlling tall item draw order

Looks like changing the node hierarchy to allow y sorting to sort individual nodes as described in this answer might help for properly sorting your character (who is taller than a single tile).

Essentially, make sure your character is at the same level in the hierarchy as all of the other tilemap nodes (instead of putting all your doors/torches/etc under one node).

Also, make sure the character's root position is at their feet so when their feet are in front of a wall, their whole body is also considered in front of the wall.

then the walls tilemap should sort the wall tiles, the character, and all the torch nodes based on their Y position. Although, I can see a small issue where the Y position of the wall tile matches the wall tile, causing the wall to be on top (maybe). This should be fixable by moving the torch down a little (by 1px or even less).

According to this issue, there is currently no support in Godot for customizing the draw order how you want, but there are some workarounds:

  1. Manually sort your tiles. "TileMaps currently break ties by rendering the oldest tiles first" so you can change the draw order by creating tiles in your intended order.

  2. "changing the second value in the TileMap's cell_custom_transform to a very small number like 0.01 so tiles are rendered from left to right."

This is because the tiles on the left have an indiscernibly smaller y value. This could be changed to -0.01 to render from right to left.

This does mean that your tiles won't be perfectly horizontally aligned, and will drift by a pixel every 100 tiles. But, this small amount of drift may be preferable to the blinking of the xsort() function I provided.

Customizing Draw Order

According to this issue, there is currently no support in Godot for customizing the draw order how you want, but there are some workarounds:

  1. Manually sort your tiles. "TileMaps currently break ties by rendering the oldest tiles first" so you can change the draw order by creating tiles in your intended order.

  2. "changing the second value in the TileMap's cell_custom_transform to a very small number like 0.01 so tiles are rendered from left to right."

This is because the tiles on the left have an indiscernibly smaller y value. This could be changed to -0.01 to render from right to left.

This does mean that your tiles won't be perfectly horizontally aligned, and will drift by a pixel every 100 tiles. But, this small amount of drift may be preferable to the blinking of the xsort() function I provided.

Controlling tall item draw order

Looks like changing the node hierarchy to allow y sorting to sort individual nodes as described in this answer might help for properly sorting your character (who is taller than a single tile).

Essentially, make sure your character is at the same level in the hierarchy as all of the other tilemap nodes (instead of putting all your doors/torches/etc under one node).

Also, make sure the character's root position is at their feet so when their feet are in front of a wall, their whole body is also considered in front of the wall.

then the walls tilemap should sort the wall tiles, the character, and all the torch nodes based on their Y position. Although, I can see a small issue where the Y position of the wall tile matches the wall tile, causing the wall to be on top (maybe). This should be fixable by moving the torch down a little (by 1px or even less).

Source Link
idbrii
  • 987
  • 6
  • 21

According to this issue, there is currently no support in Godot for customizing the draw order how you want, but there are some workarounds:

  1. Manually sort your tiles. "TileMaps currently break ties by rendering the oldest tiles first" so you can change the draw order by creating tiles in your intended order.

  2. "changing the second value in the TileMap's cell_custom_transform to a very small number like 0.01 so tiles are rendered from left to right."

This is because the tiles on the left have an indiscernibly smaller y value. This could be changed to -0.01 to render from right to left.

This does mean that your tiles won't be perfectly horizontally aligned, and will drift by a pixel every 100 tiles. But, this small amount of drift may be preferable to the blinking of the xsort() function I provided.