Wstawilem ten kod do step- i wrogowie zaczęli isc za bohaterem ale nadal kręcą się wokół własnej osi.... :(
Oto kod wroga:
W STEP:
// If the instance isn't frightened and a bullet or a dead person is near enough,
// the instance gets frighetened (starts moving at double speed) and reverses direction.
// It also sets the alarm for when the instance is no longer frightened.
if frightened=0
{
if instance_number(obj_bullet)>0
{
if point_distance(x,y,obj_bullet.x,obj_bullet.y) < 200
{
speed=3
alarm[0]=90
frightened=1
}
}
if instance_number(obj_dead)>0
{
if point_distance(x,y,obj_dead.x,obj_dead.y) < 200
{
speed=3
frightened=1
}
}
}
image_single = direction/90 // Shows the correct subimage
if speed>3 speed=3 // Makes sure the npc doesn't exceed his/her max speed.
W CREATE:
// Sets the direction to either 90, 180, 270 or 360
dice=floor(random(4))
if dice=0
{motion_set(90,1);}
if dice=1
{motion_set(180,1);}
if dice=2
{motion_set(270,1);}
if dice=3
{motion_set(360,1);}
dirchange=false // Direction hasn't been changed