just want to ask what code should i put inside the while to trigger my if statement. when the gap between the 2 entities is less than 100. the other mdl should stop walking and perform an attack.




var gap = vec_dist(my.x, your.x);

while(1)
{

if(gap >= 100)
{
var distance =-3*time_step;
c_move(me, vector(0,distance,0), NULL, GLIDE);
my.ANIMATION += 2* distance;
ent_animate(my,"walk",my.ANIMATION,ANM_CYCLE);

if(gap < 100)
{
my.ANIMATION = 0;
my.ANIMATION += 25 * time_step;
ent_animate(my, "attack", my.ANIMATION,ANM_CYCLE);
}

}

wait(1);
}