You can use Math.Abs to get the distance:
public static bool InDistance(Point Old, Point Current, int distance) { int diffX = Math.Abs(Old.X - Current.X); int diffY = Math.Abs(Old.Y - Current.Y); return diffX <= distance && diffY <= distance; }
use it:
bool arePointsInDistance = InDistance(new Point(100, 120), new Point(120, 99), 25);
source share