Pakost
The basic formula you will need is (x-h)^2/a^2 + (y-k)^2/b^2 <= 1
x and y are going to be one set of coordinates say for the bad guy
h and k are the other set of coordinates say for the good guy
a is the radius that the ellipse extends horizonally
b is the radius that the ellipse extends vertically
If the equation is less than 1, than one set of coordiantes is within the ellipse that is centered on the other set of coordinates.
So lets say that a bad guy is located at x and y coordinates of (50, 100) and has an ellipses sized detection. The ellipse extends 20 pixels above and 20 pixels below the enemy so the b value is 20 and it also extends 50 pixels to the left and 50 pixels to the right so the a value is 50. (Remember that the screen takes place in the 4th quadrant of the cartesian plane so the y axis increases as you move down.) The Hero is located at h and k coordiantes of (90, 95).
Is the Hero within the ellipse?
The equation will be populated like this: (50 - 90)^2/50^2 + (100 - 95)^2/20^2 <= 1. If you do the math, you see that it comes out to .7025 which is indeed less than 1. So he is within the enemy's ellipse. It doesn't matter whether you subtract the hero's coordinate minus the enemies coordinate because the value is being squared anyways. Just be consistant. (x - y)^2 will yield the same value as (y - x)^2 so don't get hung up about which coordinate is which. you are just finding the DIFFERENCE between them and squaring that value.