How to determine the best approximate direction I want to determine which sprite to use when one agent is "facing" another agent. My game is 2d, and uses 8 directional movement. Deciding which sprite to use for movement is easy enough since there are only 8 options when moving form one square to another. def direction(self, start, end) method for determining facing direction s width int(start 0 ) s height int(start 1 ) e width int(end 0 ) e height int(end 1 ) check directions if s height lt e height and s width e width return 'down' elif s height lt e height and s width gt e width return 'downright' elif s height e height and s width gt e width return 'left' elif s height gt e height and s width gt e width return 'upleft' elif s height gt e height and s width e width return 'up' elif s height gt e height and s width lt e width return 'upright' elif s height e height and s width lt e width return 'right' elif s height lt e height and s width lt e width return 'downleft' It's verbose, but gets the job done. start is the agents current coordinate position, and as you might guess end is the next step in the list of waypoints which makes up an agents path. The problem is that using the same function for determining which sprite should be used when attacking another agent does not look very good at all. For example, if the target is down, but only one pixel to the right, we would want to show the 'down' sprite, but this function returns 'downright' instead. How can we change it to appropriately return the fitting sprite?