procedure TFormMain.moveEnemies(value: TGameStatus);
var k: integer;
fieldX, fieldY,PosX, PosY: Integer;
begin
for k := 0
to High(EnemyManager.enemys[FPlayerLevel])
do
begin
if EnemyManager.enemys[FPlayerLevel][k].isRunning
then
begin
fieldX := (EnemyManager.enemys[FPlayerLevel][k].PosX -7)
div 32;
fieldY := (EnemyManager.enemys[FPlayerLevel][k].PosY -7)
div 32;
case map.Playground[fieldX][fieldY].nextField
of
nfDown: EnemyManager.moveEnemy(EnemyManager.enemys[FPlayerLevel][k],nfDown);
nfRight: EnemyManager.moveEnemy(EnemyManager.enemys[FPlayerLevel][k],nfRight);
nfStay:
begin
EnemyManager.enemys[FPlayerLevel][k].isRunning := false;
Dec(FPlayerLives);
initLabels;
if FPlayerLives = 0
then
begin
SetGameStatus(gsGAMEOVER);
exit;
end;
end;
else
begin
fieldX := (EnemyManager.enemys[FPlayerLevel][k].PosX +23)
div 32;
fieldY := (EnemyManager.enemys[FPlayerLevel][k].PosY +23)
div 32;
case map.Playground[fieldX][fieldY].nextField
of
nfLeft: EnemyManager.moveEnemy(EnemyManager.enemys[FPlayerLevel][k],nfLeft);
nfUp: EnemyManager.moveEnemy(EnemyManager.enemys[FPlayerLevel][k],nfUp);
end;
end;
end;
end;
end;
end;