I have a simple question I think, if point a is to the right of another point I a dirx to be 1, otherwise -1. Likewise for a diry var, if it's above the other point I want it to be -1 otherwise 1. This is what I've worked out so far:
dirx = (abs(disx+1)/(disx+1))*-1; diry = (abs(disy+1)/(disy+1))*-1;
The disx and disy are the distance from each other on x and y. I have a +1 to keep from having a division by 0 error, lastly I'm *-1 it all so that it'll match the coordinate system of the game screen where something higher has a lesser value than something lower.
My problem is that I'm still getting a division by 0 error with this code, I'm not sure why as I even added +1 to make sure it wasn't possible???