Problem with enemy move

A

acidhoover

Guest
hy i want to make the enemy going some footsteps and then stand still....then he should go back..

and it works that he goes and stand still...but when he goes back he dont stand still...he goes far far away

here the code
i createt in the create event 2 variables bewegen and punkt and they are false
with the first variable bewegen i did a alarm and when the alarm is over bewegen is true and he runs some footsteps.

Code:
px = 1000;
py = y;
if (bewegen == true)
{
if point_distance(x,y,px,py)>5
{
hspeed = spd;
state = "run";
alarm[1]=room_speed*5;
}
else if point_distance(x,y,px,py)<5
{
hspeed = 0;
state = "idle";
bewegen = false;

}
}


mx=500;
my = 0;
if (punkt == true)
{
if point_distance(x,y,mx,my)>10
{
hspeed = -spd;
state = "run";
}
else if point_distance(x,y,mx,my)<10
{
hspeed = 0;
state = "idle";
punkt = false;
}
}

something is wrong plz help sorry for bad englsih
 
Last edited by a moderator:
Top