Firstly, thanks for replies :)
Ok, so I checked out that sample (the snake game) and I understood approximately nothing... I'm new to programming, you see... Plus - I copied the code to the pascal I use and it seems not to have some functions. Anyway, I took another route, and everything seems OK to me (even though I'm not sure what I did with the imput :D), but I get an error right away after starting the thing. Any help again?
Oh, here's the code:
program TheGame;
uses Crt;
var x, y, x1, y1, sp, sx1, sx2, sx3, sx4, sx5, sy1, sy2, sy3, sy4, sy5, score: integer;
left, right, up, down, sho1: string;
ch: char;
{--------------------------------------------------------}
procedure spawn;
begin;
randomize;
sp := round (random * 64 + 5);
end;
{--------------------------------------------------------}
procedure DrawMe;
begin;
GoToxy(x+2, y-1);
Write('I');
GoToxy(x, y);
Write('<=M=>');
GoToxy(x+1, y+1);
Write('I I');
end;
{--------------------------------------------------------}
procedure shoot1;
begin
x1 := x + 2;
y1 := y - 1;
end;
{--------------------------------------------------------}
procedure SetKey;
begin
Left := 'a';
Right := 'd';
Up := 'w';
Down := 's';
sho1 := 'g';
end;
{--------------------------------------------------------}
begin
SetKey;
x := 38;
y := 15;
DrawMe;
score := 0;
x1 := 1000;
sx1 := 1000;
sx2 := 1000;
sx3 := 1000;
sx4 := 1000;
sx5 := 1000;
y1 := 10;
sy1 := 10;
sy2 := 10;
sy3 := 10;
sy4 := 10;
sy5 := 10;
While 1 = 1 do begin
{THE BULLET}
if x1 <> 1000 then y1 := y1 - 1;
if y1 = 1 then x1 := 1000;
{IF GET SHOT}
if x1 = sx1 then if
y1 = sy1 then begin
sy1 := 1;
sx1 := 1000;
x1 := 1000;
score := score + 10; end;
if x1 = sx2 then if
y1 = sy2 then begin
sy2 := 1;
sx2 := 1000;
x1 := 1000;
score := score + 10; end;
if x1 = sx3 then if
y1 = sy3 then begin
sy3 := 1;
sx3 := 1000;
x1 := 1000;
score := score + 10; end;
if x1 = sx4 then if
y1 = sy4 then begin
sy4 := 1;
sx4 := 1000;
x1 := 1000;
score := score + 10; end;
if x1 = sx5 then if
y1 = sy5 then begin
sy5 := 1;
sx5 := 1000;
x1 := 1000;
score := score + 10; end;
{SPAWNS 1 TO 5}
if sx1 = 1000 then
begin
spawn;
sx1 := sp;
sy1 := 1;
end else
sy1 := sy1 + 1;
if sx2 = 1000 then
begin
spawn;
sx2 := sp;
sy2 := 1;
end else
sy2 := sy2 + 1;
if sx3 = 1000 then
begin
spawn;
sx3 := sp;
sy3 := 1;
end else
sy3 := sy3 + 1;
if sx4 = 1000 then
begin
spawn;
sx4 := sp;
sy4 := 1;
end else
sy4 := sy4 + 1;
if sx1 = 1000 then
begin
spawn;
sx5 := sp;
sy5 := 1;
end else
sy5 := sy5 + 1;
{OK... NOW DETECT INPUT AND APPLY IT}
If keypressed then
begin
ch := readkey;
If ch = left then if x > 3 then x := x - 1;
If ch = right then if x < 74 then x := x + 1;
If ch = up then if y > 3 then y := y - 1;
If ch = down then if y < 90 then y := y + 1;
If ch = sho1 then shoot1;
end;
{COOL, GOT COORDINATES, NOW THE DRAWING}
If x1 <> 1000 then GoToXY(x1, y1);
If x1 <> 1000 then Write('*');
GoToXY(sx1, sy1);
Write('U');
GoToXY(sx2, sy2);
Write('O');
GoToXY(sx3, sy3);
Write('Y');
GoToXY(sx4, sy4);
Write('H');
GoToXY(sx5, sy5);
Write('V');
DrawMe;
{END OF FRAME}
ClrScr;
Delay(10);
End;
end.