- Code: Select all
if(knockout <1)
{
if(x > Player.x + 90)
{
x = x - 4;
if(animindex !=3)
{
ChangeAnimation("Event Actor", "WalkLeft", FORWARD);
}
}
else
{
if(x < Player.x + 91 && x > Player.x - 51)
{
CreateTimer("Event Actor", "AttackLeft", 500);
}
if(x < Player.x + 90 && x > Player.x - -75)
{
x = x + 4;
if(animindex !=3)
{
ChangeAnimation("Event Actor", "WalkLeft", BACKWARD);
}
}
}
if(x < Player.x - 90)
{
x = x + 4;
if(animindex !=2)
{
ChangeAnimation("Event Actor", "WalkRight", FORWARD);
}
}
else
{
if(x > Player.x - 91 && x < Player.x + 51)
{
CreateTimer("Event Actor", "AttackRight", 500);
}
if(x > Player.x - 89 && x < Player.x + -75)
{
x = x - 4;
if(animindex !=2)
{
ChangeAnimation("Event Actor", "WalkRight", BACKWARD);
}
}
}
}
As you might imagine, Im having trouble with the "if knockout < 1" part. The code works fine as it is, but if the knockout is more than zero, it still functions. I want the code to stop when the player is knocked out (when knockout > 1), so that the ai doesnt keep on punching into no where, while the player has a knockout animation. But it doesnt work I hope Im being clear, lol. But if you have any suggestions on what I should do, please post them.