Hi
your target should indeed not be a float.
Instead try something like this:
d = ((c1m.position.x - l.position.x) * (c1m.position.x - l.position.x)) + ((c1m.position.y - l.position.y) * (c1m.position.y - l.position.y));
if (d < currentSmallest) {
currentSmallest = d;
target = new PVector(l.position.x, l.position.y);
}
which is the x,y of the last water source you checked when the distance was the smallest.