var scanDist = 500;
action boid() {
set(my,ENABLE_SCAN);
pAgents[countAgents] = create_agent(me); // or what funct you have implement
var distToTarget;
VECTOR meToTarget;
while(me) {
you = NULL;
distToTarget = 0;
distToTarget = c_scan(my.x,my.pan,vector(360,360,scanDist), IGNORE_ME|SCAN_ENTS);
if(you != NULL) {
vec_set(meToTarget,mx.x);
vec_sub(meToTarget,you.x); // vector from my to you
// in this direction the agendt have to be redirect
} else {
vec_fill(meToTarget,0);
}
// move with c_move
wait(1);
}
}