Can someone tell me why the infantry unit won't stop when it reaches marker.x? When the distance is 1 or less it won't stop moving!! Probably so simple but here is the code

action infantry_pointer()
{

infantry = my;
while(!marker || !infantry){wait(1);}
var distance;
while(1)
{
distance = vec_dist(my,marker);
if(distance > 1) my.y-=5*time_step;

wait(1);
}
}