Just the thought of making a script for this makes me feel sick!

if (abs(player.xscreen - xscreen) < 200)//range of enemy
{
if (player.xscreen > xscreen + 20)//adjust the 20, this is distance before attacking
{
if (animindex < 3)
{
ChangeAnimation("Event Actor", "WalkRight", FORWARD);
x += 5;
}
}
else if (player.xscreen > xscreen)
{
if (animindex != 5)
{
ChageAnimation("Event Actor", "AttackRight", FORWARD);
}
}
else if (player.xscreen < xscreen - 20)
{
if (animindex < 2 || animindex == 4)
{
ChangeAnimation("Event Actor", "WalkLeft", FORWARD);
x -= 5;
}
}
else
{
if (animindex != 4)
{
ChangeAnimation("Event Actor", AttackLeft", FORWARD);
}
}
}
else
{
switch(animindex)
{
case 3: case 5:
ChangeAnimation("Event Actor", "StopRight", FORWARD);
break;
case 2: case 4:
ChangeAnimation("Event Actor", StopLeft", FORWARD);
break;
}
}
Users browsing this forum: No registered users and 1 guest