Okay, so the game has multiple people on screen at once, and I need them to be in front or behind depending on where they are. Naturally, the higher it is on screen, the further back it would be. Lower objects would be towards the front.
It's an isometric perspective sort of like Baldur's Gate or whatnot.
Here is some code I wrote that works when 2 people overlap, but gets confused if 3 people overlap at once. So, it works half of the time.
Basically, I don't want someone higher on screen to end up in front or someone lower on screen to end up behind someone. It breaks the perspective rules.
Surely, there is a better way to do this.