Just find the distance of the pursuer and the target using their x y coordinates and Pythagorean theorem. Then you can return that value to the main method. In your while loop, as long as that value is smaller or larger than a certain value, then keep redrawing your panels and let the game continue.