Hello!

I have a problem with my enemy. I generate enemys in my while like so:
Code:
  
while (j!=0)
{
loc.y=random(3000)-1600;
loc.x=random(10100)-5400;
ent_create(enemy,loc,enemy_action);
j-=1;
}



and i set 'j' how much of them i want... but the problem is that more i put in
faster they become. its like their speed is multiplying with their number.

They start to move towords me when im near them so i put c_scan in enemy_action
and called my.event=scan.
here is scan():
Code:
 

function scan
{
if (event_type == EVENT_SCAN && my.health>0 )
{
vec_set(angle_temp,dag.x);
vec_sub(angle_temp,my.x);
vec_to_angle(my.pan,angle_temp);

my.force_x=10*time;
if(temp2.y<150 && my.health>0)
{
if (vun==0)
{
my.skill2+=3*time;
if (my.skill2>=100)
{
my.skill2=0;
vun==1;
}
if (my.health>0)
{
ent_animate(me,"attack",my.skill2,ANM_CYCLE);
}
wait(1);
}
if (my.health<=0)
{

my.skill2=90;

ent_animate(me,"death",my.skill2,ANM_CYCLE);
}

vun==0;


}

if (my.force_x!=0 && temp2.y>150)
{
my.skill1+=10*time;
if (my.skill1>=100)
{
my.skill1=0;
}
my.skill2=0;
ent_animate(me,"walk",my.skill1,ANM_CYCLE);
ent_move(my.force_x,nullvector);
}


}
}



(temp2.y beeing the distance between me and the enemy)

thanks for your help.