Behave
Chase To Dead
if(player.X < target.X)
{
target.X -= speedVal
}
else if(player.X > target.X)
{
target.X += speedVal
}
speedVal= Random Speed to Chase
--------------------------------------------------------------------------------------
Chase Or Leaveing
if(speed.X == 0)
{
if(player.X < position.X)
{
position.X -= Math.Abs(speed.Y);
}
else if(player.X > position.X)
{
position.X += Math.Abs(speed.Y);
}
}
if(speed.Y ==0)
{
if(player.Y < Position.Y)
{
position.Y -= Math.Abs(speed.X);
}
else if(player.Y >position.Y)
{
position.Y += Math.Abs(speed.X);
}
}
--------------------------------------------------------------------------------------
Evading
if(player.X < position.X)
{
position.X += Math.Abs(speed.Y);
}
else if(player.X > position.X)
{
position.X -= Math.Abs(speed.Y);
}
{
position.Y += Math.Abs(speed.X);
}
else if(player.Y > position.Y)
{
position.Y -= Math.Abs(speed.X);
}
-----------------------------------------------------------------------------------------