void dCheck(agent aa[]){ int test; int testT; testT = 0; test = 0; PVector vec= new PVector(0,0); PVector vecT= new PVector(mouseX,mouseY); for(int i =0; i < amount; i ++){ PVector cent = aa[i].pos; for(int x =0; x < amount; x ++){ PVector centD = aa[x].pos; float d = cent.dist(centD); if (d < 50){ test += 1; } else{ test += 0; } } if (test > 1){ vec.set(random(-2,2),random(-2,2),0); a[i].vChange(vec); } else{ a[i].vChange(spot(vecT,i)); } test = 0; } }