#Question: is there a way to check if a 2d node is rendered before another 2d node?

2 messages · Page 1 of 1 (latest)

uncut hound
#

Hello everyone, I think (hope) this is the correct channel for this 😅.

Basically, I have this situation: simply a player and a tilemap.

The tilemap is y-sorted, so depending on its position the player's sprite can either be rendered in front of the tilemap or behind it.

Is there a simple way to check which of these two cases is true at a given frame? Or do I have to do math with the player position and the relative tilemap cell position + y sort origin?

I have considered a VisibleOnScreenNotifier2d, but since the player's position is not snapped to the tilemap, its sprite can be partly hidden, and I have to treat this case as if it was completely hidden. Unfortunately, the notifier can't tell the difference between completely or partly visible.

Thank you in advance to anyone kind enough to reply 😊

naive comet
#

sorry if i'm wrong, but as i understand your tile map is y-sorted but you don't want this, but you want the player to be y- sorted, if this is the case, then you can disable the y-sorting from the main node and make other 2dnode that has this, and put the player in this node but the tilemap don't