{ STRIL1.PAS Copyright (c) Miroslav Lízal, Tomáš Okurek } { Jednoducha strilecka pro dva hrace } { Prvni hrac: pohyb - kurzorove sipky } { strelba - enter } { Druhy hrac: pohyb - A,S,D,W } { strelba - mezernik } { } { Datum:15.01.2002 http://www.trsek.com } program strilecka; uses crt; var zmiz1,xz1,yz1,x1,y1,shot1,sx1,sy1,cls1:integer; var zmiz2,xz2,yz2,x2,y2,shot2,sx2,sy2,cls2:integer; var i,klav,poc1,poc2:integer; begin; randomize; clrscr; textcolor(white); for i:=1 to 48 do begin gotoxy(79,i); write('|') end; textcolor(black); sx1:=0; sy1:=0; x1:=2; y1:=2; sx2:=0; sy2:=0; x2:=70; y2:=40; poc1:=0; poc2:=0; repeat if shot1=1 then begin textcolor(yellow); for sx1:=1 to 78 do begin gotoxy(sx1,y1); write('.');end; for sy1:=1 to 48 do begin gotoxy(x1,sy1); write('.');end; shot1:=0; cls1:=1; if (x1=x2) or (y1=y2) then begin poc1:=poc1+1; x2:=random(78); y2:=random(48); end; end; if cls1=1 then begin sound(400); delay(50); nosound; for sx1:=1 to 78 do begin gotoxy(sx1,y1); write(' ');end; for sy1:=1 to 48 do begin gotoxy(x1,sy1); write(' ');end; cls1:=0; end; textcolor(black); if shot2=1 then begin textcolor(yellow); for sx2:=1 to 78 do begin gotoxy(sx2,y2); write('.');end; for sy2:=1 to 48 do begin gotoxy(x2,sy2); write('.');end; shot2:=0; cls2:=1; if (x2=x1) or (y2=y1) then begin poc2:=poc2+1; x1:=random(78); y1:=random(48); end; end; if cls2=1 then begin sound(200); delay(50); nosound; for sx2:=1 to 78 do begin gotoxy(sx2,y2); write(' ');end; for sy2:=1 to 48 do begin gotoxy(x2,sy2); write(' ');end; cls2:=0; end; textcolor(black); gotoxy(x1,y1);textcolor(red); write(chr(219));textcolor(black); if zmiz1=1 then begin gotoxy(xz1,yz1);write(' '); zmiz1:=0; end; gotoxy(x2,y2);textcolor(green); write(chr(219));textcolor(black); if zmiz2=1 then begin gotoxy(xz2,yz2);write(' '); zmiz2:=0; end; gotoxy(79,50);write(chr(219)); klav:=ord(readkey); if klav=0 then klav:=ord(readkey); xz1:=x1; yz1:=y1; xz2:=x2; yz2:=y2; if (klav=75) and not(x1=1 ) then begin x1:=x1-1; zmiz1:=1 end; if (klav=77) and not(x1=78) then begin x1:=x1+1; zmiz1:=1 end; if (klav=72) and not(y1=1 ) then begin y1:=y1-1; zmiz1:=1 end; if (klav=80) and not(y1=48) then begin y1:=y1+1; zmiz1:=1 end; if klav=13 then shot1:=1; if (klav=97) and not(x2=1 ) then begin x2:=x2-1; zmiz2:=1 end; if (klav=100) and not(x2=78) then begin x2:=x2+1; zmiz2:=1 end; if (klav=119) and not(y2=1 ) then begin y2:=y2-1; zmiz2:=1 end; if (klav=115) and not(y2=48) then begin y2:=y2+1; zmiz2:=1 end; if klav=32 then shot2:=1; textcolor(white);gotoxy(1,49);write('-------------------------------------------------------------------------------'); gotoxy(5,50);write('ZABIL:MRTEV '); textcolor(red);write(poc1,':',poc2,' '); textcolor(green);write(poc2,':',poc1); textcolor(white);write(' Celkove skore '); textcolor(red);write(poc1-poc2); textcolor(green);write(' ',poc2-poc1); until (klav=27); end.