function pohyb(x,y,kam:integer):boolean;
var i:integer;
begin
pohyb:=true;
if (kam=0) then
for i:=x to x+20 do if (getpixel(i,y)=15) then pohyb:=false;
if (kam=1) then
for i:=y to y+20 do if (getpixel(x,i)=15) then pohyb:=false;
if (kam=2) then
for i:=x downto x-10 do if (getpixel(i,y)=15) then pohyb:=false;
if (kam=3) then
for i:=y downto y-10 do if (getpixel(x,i)=15) then pohyb:=false;
end;
begin
grDriver := Detect;
InitGraph(grDriver,grMode,'');
x:=2;xp:=20;
y:=2;yp:=20;
bludisko(x,y);
setlinestyle(1,0,3);
setcolor(red);
outtextxy(146,83,'');
outtextxy(80,115,'L2');
outtextxy(228,168,'-');
outtextxy(138,113,'+');
outtextxy(230,55,'');
repeat
ch:=readkey;
if (ch=#0) then begin
setcolor(black);
outtextxy(xp,yp,'');
ch:=readkey;
if (ch='K') then if pohyb(xp,yp,2) then xp:=xp-10;
if (ch='M') then if pohyb(xp,yp,0) then xp:=xp+10;
if (ch='H') then if pohyb(xp,yp,3) then yp:=yp-10;
if (ch='P') then if pohyb(xp,yp,1) then yp:=yp+10;
if (xp=140) and (yp=110) then begin
sound(220); { ubera pocet zivotov }
delay(500);
nosound;
str(zivot,ret_z);
setcolor(black);
outtextxy(328,38,'Pocet zivotov : '+ret_z);
zivot:=zivot-1;
str(zivot,ret_z);
setcolor(cyan);
outtextxy(328,38,'Pocet zivotov : '+ret_z);
setcolor(black);
outtextxy(138,113,'+');
end;
if (xp=150) and (yp=80) then begin
sound(320); { pridava pocet hubiek }
delay(500);
nosound;
str(hubka,ret_h);
setcolor(black);
outtextxy(328,102,'Hubka : '+ret_h);
hubka:=hubka+1;
str(hubka,ret_h);
setcolor(cyan);
outtextxy(328,102,'Hubka : '+ret_h);
setcolor(black);
outtextxy(146,83,'');
end;
if (xp=230) and (yp=170) then begin
sound(420); { pridava pocet zivotov }
delay(500);
nosound;
str(zivot,ret_z);
setcolor(black);
outtextxy(328,38,'Pocet zivotov : '+ret_z);
zivot:=zivot+1;
str(zivot,ret_z);
setcolor(cyan);
outtextxy(328,38,'Pocet zivotov : '+ret_z);
setcolor(black);
outtextxy(228,168,'-');
end;
if (xp=230) and (yp=50) then begin
sound(520); { pridava pocet bodov }
delay(500);
nosound;
str(body,ret_b);
setcolor(black);
outtextxy(328,70,'Pocet bodov : '+ret_b);
body:=body+100;
str(body,ret_b);
setcolor(cyan);
outtextxy(328,70,'Pocet bodov : '+ret_b);
setcolor(black);
outtextxy(230,55,'');
end;
if (xp=80) and (yp=120) then Level_2;
setcolor(blue);
outtextxy(10,440,'ÛÛÛÛÛ');
outtextxy(10,470,'ÛÛÛÛÛ');
setcolor(white);
str(xp,ret_h);outtextxy(10,440,ret_h);
str(yp,ret_h);outtextxy(10,470,ret_h);
if (body=200) or (body=400) or (body=800) then begin
sound(420); { pridava pocet zivotov, ked je pocet bodov 10 000 }
delay(500);
nosound;
str(zivot,ret_z);
setcolor(black);
outtextxy(328,38,'Pocet zivotov : '+ret_z);
zivot:=zivot+1;
str(zivot,ret_z);
setcolor(cyan);
outtextxy(328,38,'Pocet zivotov : '+ret_z);
end;
setcolor(white);
outtextxy(xp,yp,'');
end;
until (ch=#27) or (zivot=0) or (body=900) or (zivot=5);
closegraph;
end.