rockXY = findRGBCluster(testColors, Areas.GAME, 100); if (rockXY != null) { if (distance(new XY(240, 185), rockXY[0]) < distance(new XY(240, 185), Closest)) { Closest = rockXY[0]; } mouseMove(Closest); }