How would I go about determining a condition to either if an object is behind or in front of another object, in a top down shooter?
Initially I was comparing the x and y locations, but the issue is that now both 'player' and 'enemy' objects can fully rotate and move about. So I'm experimenting with trying to compare angles relative to the 'target's' angle, but so far it doesn't work at all so I figure I must be taking the wrong approach.
I found this from another thread but I can't seem to get it to work from a front/back standpoint:
[quote:38z0tl9l]angle(player.x,player.y,object.x,object.y) is between player.angle and player.angle+179 (hit from right)
angle(player.x,player.y,object.x,object.y) is between player.angle and player.angle-179 (hit from left)
The game doesn't use physical objects, as it's a RPG pseudo-y game and 'attacks' are handled in functions which simulate dice rolls, damage etc etc, so I can't really use collision sprites, or at least I'm not sure how to without an actual projectile object.