[sloved]
` void seek(PVector target) {
// only run if mousecursor is pressed
if (mousePressed) {
// if creatures are nerby target
float nerby=(10);
for (Creature c : creatures) {
float d = PVector.dist(target, c.position);
if (d == nerby) {
fill(a); // pink
PVector desired = PVector.sub(target, position);
desired.normalize();
desired.mult(maxspeed);
PVector steer = PVector.sub(desired, velocity);
steer.limit(maxforce);
applyForce(steer);
}
}
} else {
fill(c); //blue
}
}`