Easy Top Down Shooter

Code:
(* Easy Top Down Shooter *)
{ Created by: damagex @ scar-divi.com }
{ Version 1.2b                        }

const              //Difficulty settings\\
fieldWidth         = 30;   // Low = easy - High = hard
fieldHeight        = 10;   // Low = hard - High = easy
                   //Other Settings\\
useBackground      = 1;    // 0 = Background off - 1 = Background on
weapon             = 0;    // 0 = bullets - 1 = seeking missles
refreshRate        = 10;   // Higher makes the game slower

var
fieldArr        : Array [1..fieldWidth]  of Array[0..fieldHeight] of String;
field           : Array [0..fieldHeight] of AnsiString;
enemy, bullet   : Array [0..fieldHeight] of Integer;
i, e, f, l, bg, current, Lifes, score : Integer;
isShooting, isEnemy, spawnEnemy       : Integer;

information, layout, layout2    : String;
repeater                        : Integer;

begin
repeater  := 0;
lifes     := 3;

spawnEnemy  := 0;
isEnemy     := 0;
current     := fieldWidth div 2;
isShooting  := 0;
score       := 0;
information := '';

for i := low(enemy) to high(enemy) do begin
    enemy[i]  := 0;
end;
for i := low(bullet) to high(bullet) do begin
    bullet[i] := 0;
end;
repeat

// Input Handler
if (IsArrowDown(1)) then begin
   if(current < fieldWidth) then begin
              current := current + 1;
   end;
end;
if (IsArrowDown(3)) then begin
   if(current > Low(fieldArr)) then begin
              current := current - 1;
   end;
end;
if (IsFunctionKeyDown(4)) AND not (isShooting <> 0) then begin
   bullet[1]  := current;
   isShooting := 1;
end;

// Enemy handler
spawnEnemy := 1;
if (spawnEnemy = 1) AND not (isEnemy <> 0) then begin
   isEnemy    := 1;
   enemy[high(enemy)] := RandomRange(Low(fieldArr)+1,fieldWidth);
   spawnEnemy := 0;
end;
layout := '';
for f := low(fieldArr) to fieldWidth do begin
    layout   := layout + '_';
end;

for f := low(field) to fieldHeight do begin
    field[f] := '|';
end;

for i := low(fieldArr) to fieldWidth do begin
    for e:= low(field) to fieldHeight do begin
        if (e = 0) then begin
           if (i <> current) then begin
              fieldArr[i][0] := ' ';
           end else begin
              fieldArr[i][0] := 'A';
           end;
        end else begin
           if (i <> bullet[e]) then begin
              if (i <> enemy[e]) then begin
                 if (useBackground = 1) then begin
                    bg := RandomRange(0,50);
                 end;
                 if not (bg = 1) then begin
                    fieldArr[i][e] := ' ';
                    bg := 0;
                 end else begin
                    fieldArr[i][e] := '+';
                 end;
              end else begin
                 fieldArr[i][e] := 'V';
              end;
           end else begin
               case weapon of
               0 : begin
                   fieldArr[i][e] := '.';
                   end;
               1 : begin
                   fieldArr[i][e] := '|';
                   end;
               end;
           end;
        end;
    end;
           for f := low(field) to high(field) do begin
               field[f] := field[f] + fieldArr[i][f];
           end;
end;

for f := low(field) to high(field) do begin
       field[f] := field[f] + '|';
end;

clearDebug;
writeLn(' '+layout+' ');
i := high(field);
while (i > -1)  do begin
    writeLn(field[i]);
    i := i - 1;
end;
writeLn('|'+layout+'|');
WriteLn(information);
WriteLn('Left/Right - Arrow keys');
WriteLn('Shoot - CTRL');
WriteLn('Press "CTRL + ALT + S" to stop playing');
WriteLn('Created by: Damagex @ scar-divi.com');
WriteLn(bg);
wait(refreshRate);
i := 1;
for i := 1 to fieldHeight do begin
    if (enemy[i] = bullet[i]) AND (enemy[i] <> 0) OR (enemy[i-1] = bullet[i]) AND (enemy[i-1] <> 0) then begin
       enemy[i]   := 0;
       enemy[i-1] := 0;
       bullet[i]  := 0;
       isShooting := 0;
       isEnemy    := 0;
       Score      := Score + 1;
    end;
end;

i := 1;
e := 0;
if (isShooting = 1) then begin
   while (e = 0) do begin
       if (i = high(bullet)) then begin
          isShooting := 0;
          e := 1;
       end else if (bullet[i] > 0) then begin
        if (weapon = 1) then begin
          for e := low(enemy) to high(enemy) do begin
              if (enemy[e] > 0) then begin
                 if (enemy[e] > bullet[i]) then begin
                     bullet[i+1] := bullet[i] + 1;
                 end else if (enemy[e] < bullet[i]) then begin
                     bullet[i+1] := bullet[i] - 1;
                 end else begin
                     bullet[i+1] := bullet[i];
                 end;
              end;
          end;
        end else begin
          e           := 1;
          bullet[i+1] := bullet[i];
        end;
       end;
       bullet[i]  := 0;
       i          := i + 1;
   end;
end;

if (repeater > 10) then begin
   i := fieldHeight;
   e := 0;
if (isEnemy = 1) then begin
   while (e = 0) do begin
       if (i = 1) then begin
          e       := 1;
          isEnemy := 0;
          lifes   := lifes-1;
       end else if (enemy[i] > 0) then begin
          e       := 1;
          enemy[i-1] := enemy[i];
       end;
       enemy[i] := 0;
       i := i - 1;
   end;
end;
repeater := 0;
end else begin
repeater := repeater + 1;
end;
information := 'Kills: ' + IntToStr(score) + ' - Lifes left: ' + IntToStr(lifes);
until(lifes = -1);
ClearDebug;
WriteLn(' _____________________________________________________________________ ');
WriteLn('|  ______ _______ _______ _______       _____  _    _ _______  ______ |');
WriteLn('| |  ____ |_____| |  |  | |______      |     |  \  /  |______ |_____/ |');
WriteLn('| |_____| |     | |  |  | |______      |_____|   \/   |______ |    \_ |');
WriteLn('|                            Game Report                scar-divi.com |');
WriteLn('| Final Kill Count: ' + IntToStr(score) + '                                         Damagex |');
WriteLn('|_____________________________________________________________________|?');

end.
HOW TO PLAY
Load up SCAR Divi (If you don't have it, download is below.)
Paste in the script above
Expand the debug window
Press Run or CTRL+ALT+R


CONTROLS

Left / Right - Arrow Keys
Shoot - CTRL

Run - CTRL+ALT+R
Stop - CTRL+ALT+S
Pauze - CTRL+ALT+A
You can change some settings at the top of the script too!

SCAR DOWNLOAD
SCAR Divi - Download