You could determine the direction the enemy has to walk (in degrees, up is 0 degrees), and then using a certain step size to determine how many pixels the enemy has to go in the X and Y direction.
For example:
[pascal]
const
STEP_SIZE = 5;
procedure AI;
var
Angle: Single;
begin
Angle := Atan((PlayerY - EnemyY) / (PlayerX - EnemyX));
EnemyX := EnemyX + Cos(Angle) * STEP_SIZE;
EnemyY := EnemyY + Sin(Angle) * STEP_SIZE;
end;
[/pascal]
Bookmarks