Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- program bOOmberman;
- uses crt,dos;
- var
- tab : array [1..29,1..18] of char;
- tabBombWybuch : array [3..27,2..17] of longint;
- tabBombPoWybuchu : array [3..27,2..17] of longint;
- tabRuchPotwor : array [3..27,2..17] of longint;
- wzorMap : array [1..25,1..16] of char;
- tabPoziom : array [1..10,1..25,1..16] of char;
- idziesz,idbomby,menu,odPauzuj{blokPauzy} : char;
- i,j,bomby,ileBomb,potwory,bylPotwor,ostByloPotwo,ostByloBomb,mozliwychBomb,jestAleZginal,
- zycia,dodamZycie,czyZyje,instrwlwyl,poziom,menuWybor,menuWybor2,menuWybor3,menuWybor4,
- trudnosc,blokPauzy : byte;
- Hour,Min,Sec,HSec : word;
- czas : longint;
- label koniec,restart,poczatek,powrotDoMenu,pauza,wznowGre,
- gora,dol,lewo,prawo;
- {lvl do wypelniania tablicy tabPoziom[lvl,*,*], poziom to konkretna mapka}
- procedure wyswietl(wyswco:byte);
- var x,y:byte;
- begin
- if wyswco=0 then begin
- for x:=3 to 27 do begin
- for y:=2 to 17 do begin
- gotoxy(10+x,2+y);
- write(tab[x,y]);
- end;end;end;
- if wyswco=1 then begin
- for x:=1 to 25 do begin
- for y:=1 to 16 do begin
- if x<>25 then tab[x+2,y+1]:=tabPoziom[poziom,x,y];
- gotoxy(10+x+2,2+y+1);
- write(tab[x+2,y+1]);
- end;end;end;
- if wyswco=3 then begin
- for x:=1 to 25 do begin
- for y:=1 to 16 do begin
- gotoxy(10+x+2,2+y+1);
- if (tab[x+2,y+1]<>('˛'))AND(tab[x+2,y+1]<>#176) then begin
- tab[x+2,y+1]:=#176;
- write(tab[x+2,y+1]);end;
- end;end;end;
- end;
- procedure sciana;
- var x,y : byte;
- begin
- for x:=1 to 29 do begin
- for y:=1 to 18 do begin
- if (x=1)OR(x=2)OR(x=28)OR(x=29)OR(y=1)OR(y=18) then tab[x,y]:=('˛');
- gotoxy(10+x,2+y);write(tab[x,y]);
- end;
- end;end;
- procedure polozenieRestart;
- begin
- REPEAT
- i:=random(28);
- j:=random(18);UNTIL tab[i,j]=#176;
- gotoxy(10+i,2+j);tab[i,j]:=#4;write(tab[i,j]);gotoxy(1,1);
- end;
- {*** wzor do generatora map ***}
- procedure mapWzor;
- var x,y : byte;
- begin
- for x:=1 to 25 do begin
- for y:=1 to 16 do begin
- wzorMap[x,y]:=#176;
- end;end;{mozna modyfikowac jak sie chce}
- wzorMap[2,2]:=('˛');wzorMap[3,2]:=('˛');wzorMap[4,2]:=('˛');wzorMap[3,3]:=('˛');
- wzorMap[8,3]:=('˛');wzorMap[9,3]:=('˛');
- wzorMap[12,2]:=('˛');wzorMap[12,3]:=('˛');
- wzorMap[19,2]:=('˛');wzorMap[19,3]:=('˛');
- wzorMap[22,2]:=('˛');wzorMap[22,3]:=('˛');wzorMap[23,2]:=('˛');wzorMap[23,3]:=('˛');wzorMap[24,2]:=('˛');wzorMap[24,3]:=('˛');
- {koniec 1.}
- wzorMap[3,6]:=('˛');wzorMap[3,7]:=('˛');wzorMap[4,7]:=('˛');
- wzorMap[7,7]:=('˛');wzorMap[8,7]:=('˛');wzorMap[9,7]:=('˛');
- wzorMap[13,6]:=('˛');wzorMap[13,7]:=('˛');
- wzorMap[17,6]:=('˛');wzorMap[18,6]:=('˛');wzorMap[19,6]:=('˛');
- wzorMap[23,6]:=('˛');wzorMap[23,7]:=('˛');wzorMap[24,6]:=('˛');wzorMap[24,7]:=('˛');{koniec 2.}
- wzorMap[2,11]:=('˛');wzorMap[3,11]:=('˛');wzorMap[3,10]:=('˛');wzorMap[4,11]:=('˛');
- wzorMap[7,10]:=('˛');wzorMap[8,10]:=('˛');
- wzorMap[12,10]:=('˛');wzorMap[12,11]:=('˛');wzorMap[13,11]:=('˛');
- wzorMap[17,10]:=('˛');wzorMap[17,11]:=('˛');wzorMap[18,10]:=('˛');wzorMap[18,11]:=('˛');
- wzorMap[22,10]:=('˛');wzorMap[22,11]:=('˛');wzorMap[23,10]:=('˛');wzorMap[23,11]:=('˛');{koniec 3.}
- wzorMap[3,14]:=('˛');wzorMap[3,15]:=('˛');wzorMap[4,14]:=('˛');
- wzorMap[7,14]:=('˛');wzorMap[7,15]:=('˛');wzorMap[8,14]:=('˛');wzorMap[8,15]:=('˛');wzorMap[9,14]:=('˛');wzorMap[9,15]:=('˛');
- wzorMap[12,15]:=('˛');wzorMap[13,15]:=('˛');
- wzorMap[17,15]:=('˛');wzorMap[18,15]:=('˛');wzorMap[19,15]:=('˛');
- wzorMap[23,14]:=('˛');wzorMap[24,14]:=('˛');{koniec 4.}
- end;
- procedure mapGenerator;
- var a,b,c,d,e,s,t,x,y,liczbakostek,lvl : byte;
- begin
- REPEAT
- lvl:=lvl+1;a:=1;b:=5;c:=1;e:=4;liczbakostek:=0;
- REPEAT
- d:=random(20)+1;
- if d=1 then begin s:=1;t:=1;end;if d=2 then begin s:=6;t:=1;end;
- if d=3 then begin s:=11;t:=1;end;if d=4 then begin s:=16;t:=1;end;if d=5 then begin s:=21;t:=1;end;
- if d=6 then begin s:=1;t:=5;end;if d=7 then begin s:=6;t:=5;end;
- if d=8 then begin s:=11;t:=5;end;if d=9 then begin s:=16;t:=5;end;if d=10 then begin s:=21;t:=5;end;
- if d=11 then begin s:=1;t:=9;end;if d=12 then begin s:=6;t:=9;end;
- if d=13 then begin s:=11;t:=9;end;if d=14 then begin s:=16;t:=9;end;if d=15 then begin s:=21;t:=9;end;
- if d=16 then begin s:=1;t:=13;end;if d=17 then begin s:=6;t:=13;end;
- if d=18 then begin s:=11;t:=13;end;if d=19 then begin s:=16;t:=13;end;if d=20 then begin s:=21;t:=13;end;
- for x:=a to b do begin
- for y:=c to e do begin
- tabPoziom[lvl,x,y]:=wzorMap[s,t];
- t:=t+1;
- end;
- s:=s+1;
- end;
- if b=25 then begin c:=c+4;e:=e+4;a:=1;b:=5 end ELSE a:=a+5;b:=b+5;
- liczbakostek:=liczbakostek+1;
- UNTIL liczbakostek=20;
- UNTIL lvl=10;
- gotoxy(18,21);write(' ');
- end;
- procedure fbombki;
- begin
- idbomby:=('ţ');
- if (tab[i,j]<>idbomby)AND(bomby>0) then begin
- bomby:=bomby-1;tab[i,j]:=idbomby;
- tabBombWybuch[i,j]:=czas+3;
- end;
- end;
- procedure sprawdzBomby;
- var x,y : byte;
- begin
- ileBomb:=0;
- for x:=3 to 27 do begin
- for y:=2 to 17 do begin
- if tab[x,y]=idbomby then ileBomb:=ileBomb+1;
- end;
- end;
- end;
- procedure sprawdzBohatera;
- var x,y,licznik : byte;
- begin
- czyZyje:=0;
- licznik:=0;
- REPEAT
- for x:=3 to 27 do begin
- for y:=2 to 17 do begin
- if tab[x,y]=#4 then czyZyje:=1;
- end;
- end;
- licznik:=licznik+1;
- UNTIL licznik=3;
- end;
- procedure tabGoraBomby;
- begin
- gotoxy(16,1);write(' ');
- gotoxy(16,1);
- write('Pozostalo ',bomby,' bomb');end;
- procedure tabGoraPotwory;
- begin
- gotoxy(16,2);write(' ');
- gotoxy(20,2);
- write('Potworow: ',potwory);end;
- procedure tabPrawaZycia;
- begin
- gotoxy(53,3);write(' ');
- gotoxy(53,3);
- write('Zycia: ',zycia);end;
- procedure ktoryPoziom;
- begin
- gotoxy(21,21);write(' ');gotoxy(21,21);write('Poziom ',poziom,'.');
- end;
- procedure bombaMiga;
- var x,y:byte;
- begin
- for x:=3 to 27 do begin
- for y:=2 to 17 do begin
- if tab[x,y]=('ţ') then begin
- gotoxy(10+x,2+y);
- textcolor(7+blink);
- write(tab[x,y]);end;textcolor(7);end;
- end;gotoxy(1,1);end;
- procedure wybuch;
- var m,n,p,x,y,a,b : byte;
- begin
- for m:=3 to 27 do begin
- for n:=2 to 17 do begin
- if tab[m,n]=idbomby then begin
- if tabBombWybuch[m,n]<=czas then begin
- tab[m,n]:=#15;gotoxy(10+m,2+n);tabBombWybuch[m,n]:=0;write(tab[m,n]);
- a:=m+2;
- b:=n+2;
- for x:=m-2 to a do tabBombPoWybuchu[x,n]:=czas+2;
- for y:=n-2 to b do tabBombPoWybuchu[m,y]:=czas+2;
- p:=0;REPEAT p:=p+1;if tab[m+p,n]=idbomby then begin tabBombWybuch[m+p,n]:=0;
- wybuch;end;
- if tab[m+p,n]<>('˛') then begin tab[m+p,n]:=#15;gotoxy(10+m+p,2+n);write(tab[m+p,n]);end;
- UNTIL (p=2)OR(tab[m+p,n]=('˛'));
- p:=0;REPEAT p:=p+1;if tab[m-p,n]=idbomby then begin tabBombWybuch[m-p,n]:=0;
- wybuch;end;
- if tab[m-p,n]<>('˛') then begin tab[m-p,n]:=#15;gotoxy(10+m-p,2+n);write(tab[m-p,n]);end;
- UNTIL (p=2)OR(tab[m-p,n]=('˛'));
- p:=0;REPEAT p:=p+1;if tab[m,n-p]=idbomby then begin tabBombWybuch[m,n-p]:=0;
- wybuch;end;
- if tab[m,n-p]<>('˛') then begin tab[m,n-p]:=#15;gotoxy(10+m,2+n-p);write(tab[m,n-p]);end;
- UNTIL (p=2)OR(tab[m,n-p]=('˛'));
- p:=0;REPEAT p:=p+1;if tab[m,n+p]=idbomby then begin tabBombWybuch[m,n+p]:=0;
- wybuch;end;
- if tab[m,n+p]<>('˛') then begin tab[m,n+p]:=#15;gotoxy(10+m,2+n+p);write(tab[m,n+p]);end;
- UNTIL (p=2)OR(tab[m,n+p]=('˛'));
- end;
- end;
- end;
- end;
- end;
- procedure sprzatajWybuch;
- var x,y : byte;
- begin
- for x:=3 to 27 do begin
- for y:=2 to 17 do begin
- if tab[x,y]=#15 then begin
- if tabBombPoWybuchu[x,y]<=czas then begin
- tab[x,y]:=#176;gotoxy(10+x,2+y);write(tab[x,y]);
- end;
- end;
- end;
- end;
- sprawdzBohatera;
- end;
- procedure genPotwory(potwory:byte);
- var x,y,u,p,r,s,licznik,mozeByc : byte;
- begin licznik:=0;mozeByc:=0;
- if (potwory>0)AND(potwory<11) then begin
- REPEAT
- REPEAT
- x:=random(25)+1;
- y:=random(16)+1;
- p:=x+1;
- s:=y+1;
- if (tab[x,y]<>('˛'))AND(tab[x,y]<>#4)AND(tab[x,y]<>#2) then mozeByc:=1;
- for u:=x-1 to p do begin
- for r:=y-1 to s do begin
- if (tab[u,r]=#4)OR(tab[u,r]=#2) then mozeByc:=0;
- end;
- end;
- UNTIL (x>2)AND(x<26)AND(y>1)AND(y<17)AND(mozeByc=1);
- tab[x,y]:=#2;gotoxy(10+x,y+2);write(tab[x,y]);
- mozeByc:=0;
- licznik:=licznik+1;
- UNTIL licznik=potwory;end;end;
- procedure sprawdzPotwory;
- var x,y : byte;
- begin
- potwory:=0;
- for x:=3 to 27 do begin
- for y:=2 to 17 do begin
- if tab[x,y]=#2 then potwory:=potwory+1;
- end;
- end;
- end;
- procedure ruchPotwora;
- var x,y,gdzieIsc,moze,niemoze,pionPozi : byte;
- begin
- for x:=3 to 27 do begin
- for y:=2 to 17 do begin
- if tab[x,y]=#2 then begin
- if tabRuchPotwor[x,y]<=czas then begin
- niemoze:=0;
- REPEAT
- gdzieIsc:=random(8)+1;
- if gdzieIsc>4 then gdzieIsc:=5;
- moze:=0;
- case gdzieIsc of
- 1: begin gora:
- if tab[x,y-1]=#15 then begin tab[x,y]:=#176;gotoxy(x+10,y+2);write(tab[x,y]);moze:=1;end ELSE begin
- if (tab[x,y-1]<>#178)AND(y>1)AND(tab[x,y-1]<>#2)AND(tab[x,y-1]<>idbomby) then begin
- if tab[x,y-1]=#4 then begin jestAleZginal:=1;end;
- tab[x,y-1]:=#2;gotoxy(x+10,y+2-1);write(tab[x,y-1]);gotoxy(x+10,y+2);tab[x,y]:=#176;write(tab[x,y]);
- tabRuchPotwor[x,y]:=0;tabRuchPotwor[x,y-1]:=czas+trudnosc;moze:=1;end ELSE begin moze:=0;niemoze:=niemoze+1;end;
- end;
- end;
- 2: begin dol: if tab[x,y+1]=#15 then begin tab[x,y]:=#176;gotoxy(x+10,y+2);write(tab[x,y]);moze:=1;end ELSE begin
- if (tab[x,y+1]<>#178)AND(y<17)AND(tab[x,y+1]<>#2)AND(tab[x,y+1]<>idbomby) then begin
- if tab[x,y+1]=#4 then begin jestAleZginal:=1;end;
- tab[x,y+1]:=#2;gotoxy(x+10,y+2+1);write(tab[x,y+1]);gotoxy(x+10,y+2);tab[x,y]:=#176;write(tab[x,y]);
- tabRuchPotwor[x,y]:=0;tabRuchPotwor[x,y+1]:=czas+trudnosc;moze:=1;end ELSE begin moze:=0;niemoze:=niemoze+1;end;
- end;
- end;
- 3: begin lewo:
- if tab[x-1,y]=#15 then begin tab[x,y]:=#176;gotoxy(x+10,y+2);write(tab[x,y]);moze:=1;end ELSE begin
- if (tab[x-1,y]<>#178)AND(x>2)AND(tab[x-1,y]<>idbomby)AND(tab[x-1,y]<>#2) then begin
- if tab[x-1,y]=#4 then begin jestAleZginal:=1;end;
- tab[x-1,y]:=#2;gotoxy(x+10-1,y+2);write(tab[x-1,y]);gotoxy(x+10,y+2);tab[x,y]:=#176;write(tab[x,y]);
- tabRuchPotwor[x,y]:=0;tabRuchPotwor[x-1,y]:=czas+trudnosc;moze:=1;end ELSE begin moze:=0;niemoze:=niemoze+1;end;
- end;
- end;
- 4: begin prawo:
- if tab[x+1,y]=#15 then begin tab[x,y]:=#176;gotoxy(x+10,y+2);write(tab[x,y]);moze:=1;end ELSE begin
- if (tab[x+1,y]<>#178)AND(x<28)AND(tab[x+1,y]<>#2)AND(tab[x+1,y]<>idbomby) then begin
- if tab[x+1,y]=#4 then begin jestAleZginal:=1;end;
- tab[x+1,y]:=#2;gotoxy(x+10+1,y+2);write(tab[x+1,y]);gotoxy(x+10,y+2);tab[x,y]:=#176;write(tab[x,y]);
- tabRuchPotwor[x,y]:=0;tabRuchPotwor[x+1,y]:=czas+trudnosc;moze:=1;end ELSE begin moze:=0;niemoze:=niemoze+1;end;
- end;
- end;
- 5: begin
- pionPozi:=random(2);
- if pionPozi=0 then begin
- if y>j then goto gora ELSE goto dol
- end ELSE begin
- if x>i then goto lewo ELSE goto prawo;
- end;
- end;
- end;
- UNTIL (moze=1)OR(niemoze=4);
- end;
- end;
- end;
- end;
- end;
- procedure potworyZaczekajcie;
- var x,y : byte;
- begin
- for x:=3 to 27 do begin
- for y:=2 to 17 do begin
- tabRuchPotwor[x,y]:=czas+2*trudnosc;
- end;
- end;
- end;
- procedure jakiPoziomTrudnosci;
- var tekst : string;
- begin
- gotoxy(3,22);write('Poziom trudnosci:');
- if trudnosc=3 then begin tekst:='LATWY';textcolor(yellow);end;
- if trudnosc=2 then begin tekst:='SREDNI';textcolor(brown);end;
- if trudnosc=1 then begin tekst:='TRUDNY';textcolor(red);end;
- gotoxy(21,22);write(tekst);textcolor(7);
- end;
- procedure instrukcja(pozInstr:byte);
- var a,b:byte;
- begin
- instrwlwyl:=instrwlwyl+1;
- if instrwlwyl=1 then begin textcolor(green);
- gotoxy(pozInstr,8);write('w - ruch w gore'); {42}
- gotoxy(pozInstr,9);write('s - ruch w dol');
- gotoxy(pozInstr,10);write('a - ruch w lewo');
- gotoxy(pozInstr,11);write('d - ruch w prawo');
- gotoxy(pozInstr,12);write('enter - podloz bombe');
- gotoxy(pozInstr,13);write('r - restart');
- gotoxy(pozInstr,14);write('l - skakanie miedzy poziomami');
- gotoxy(pozInstr,15);write('p - pauza (kolejne nacisniecie wznawia)');
- gotoxy(pozInstr,16);write('m - powrot do menu');
- gotoxy(pozInstr,17);write('z - wylacz gre');textcolor(red);
- gotoxy(pozInstr,18);write('Bomby mozna zbierac (przed wybuchem)!');textcolor(7);
- end;
- if instrwlwyl=2 then begin
- for a:=0 to 40 do begin
- for b:=1 to 20 do begin
- gotoxy(a+40,4+b);write(' ');
- end;
- end;instrwlwyl:=0;end;end;
- procedure pokazMenu(ktoreMenu:byte);
- var a,posprzatajPoziomy:byte;
- begin
- REPEAT
- gotoxy(1,1);
- case ktoreMenu of
- 1: begin
- writeln('B O M B E R M A N');
- menu:=readkey;
- if (menu='w')OR(menu='W') then begin
- if menuWybor<4 then menuWybor:=menuWybor+1;end;
- if (menu='s')OR(menu='S') then begin
- if menuWybor>1 then menuWybor:=menuWybor-1;end;
- case menuWybor of
- 4: begin textcolor(red);writeln(' NOWA GRA');textcolor(7);
- writeln('POZIOM TRUDNOSCI ');writeln('INSTRUKCJA ');writeln('WYJDZ ');end;
- 3: begin writeln('NOWA GRA ');textcolor(red);
- writeln(' POZIOM TRUDNOSCI');textcolor(7);writeln('INSTRUKCJA ');writeln('WYJDZ ');end;
- 2: begin writeln('NOWA GRA ');writeln('POZIOM TRUDNOSCI ');
- textcolor(red);writeln(' INSTRUKCJA');textcolor(7);writeln('WYJDZ ');end;
- 1: begin writeln('NOWA GRA ');writeln('POZIOM TRUDNOSCI ');
- writeln('INSTRUKCJA ');textcolor(red);writeln(' WYJDZ');textcolor(7);end;
- end;end;
- 2: begin
- textcolor(green);writeln('POZIOM TRUDNOSCI');textcolor(7);
- menu:=readkey;
- if (menu='w')OR(menu='W') then begin
- if menuWybor2<4 then menuWybor2:=menuWybor2+1;end;
- if (menu='s')OR(menu='S') then begin
- if menuWybor2>1 then menuWybor2:=menuWybor2-1;end;
- case menuWybor2 of
- 4: begin textcolor(red);writeln(' LATWY');textcolor(7);writeln('SREDNI ');writeln('TRUDNY ');writeln('MENU ');end;
- 3: begin writeln('LATWY ');textcolor(red);writeln(' SREDNI');textcolor(7);writeln('TRUDNY ');writeln('MENU ');end;
- 2: begin writeln('LATWY ');writeln('SREDNI ');textcolor(red);writeln(' TRUDNY');textcolor(7);writeln('MENU ');end;
- 1: begin writeln('LATWY ');writeln('SREDNI ');writeln('TRUDNY ');textcolor(red);writeln(' MENU');textcolor(7);end;
- end;end;
- 3: begin
- textcolor(green);writeln('Czy chcesz zagrac jeszcze raz?');textcolor(7);
- menu:=readkey;
- if (menu='w')OR(menu='W') then begin
- if menuWybor3<2 then menuWybor3:=menuWybor3+1;end;
- if (menu='s')OR(menu='S') then begin
- if menuWybor3>1 then menuWybor3:=menuWybor3-1;end;
- case menuWybor3 of
- 2: begin textcolor(red);writeln(' TAK');textcolor(7);writeln('NIE ');end;
- 1: begin textcolor(7);writeln('TAK ');textcolor(red);writeln(' NIE');textcolor(7);end;
- end;end;
- 4: begin
- posprzatajPoziomy:=1;
- menu:=readkey;
- gotoxy(1,2);
- if (menu='s')OR(menu='S') then begin
- if menuWybor4<10 then menuWybor4:=menuWybor4+1;end;
- if (menu='w')OR(menu='W') then begin
- if menuWybor4>1 then menuWybor4:=menuWybor4-1;end;
- for a:=1 to 10 do begin
- if menuWybor4 = a then begin
- textcolor(red);writeln(a);textcolor(7);poziom:=menuWybor4;
- end ELSE begin writeln(a);end;
- end;gotoxy(1,1);end;
- end;
- UNTIL menu=#13;
- if posprzatajPoziomy=1 then begin
- for a:=1 to 10 do begin
- gotoxy(1,a+1);write(' ');
- end;
- posprzatajPoziomy:=0;
- end;
- end;
- procedure wyswietlWyborPoziomu;
- var a : byte;
- begin
- menuWybor4:=poziom;gotoxy(1,2);
- for a:=1 to 10 do begin
- if menuWybor4 <> a then
- writeln(a) ELSE begin textcolor(red);writeln(a);textcolor(7); end;
- end;
- end;
- procedure ruch(i,j:byte);
- begin
- if tab[i,j]=('ţ') then begin
- bomby:=bomby+1;end;
- if (tab[i,j]=#2)OR(tab[i,j]=#15) then begin
- bylPotwor:=1;
- end ELSE bylPotwor:=0;
- tab[i,j]:=#4;
- gotoxy(10+i,2+j);write(tab[i,j]);
- end;
- procedure Timer;
- begin
- REPEAT
- GetTime(Hour,Min,Sec,Hsec);czas:=3600*hour+60*Min+Sec;
- wybuch;sprzatajWybuch;sprawdzBomby;ruchPotwora;bombaMiga;
- UNTIL keypressed;
- end;
- {* Cialo programu *}
- begin trudnosc:=2;poczatek:instrwlwyl:=0;{aby nie naciskac po dedzie (przez 2)}clrscr;randomize;
- REPEAT powrotDoMenu:clrscr;menuWybor:=4;
- gotoxy(1,1);writeln('B O M B E R M A N');
- textcolor(red);writeln(' NOWA GRA');textcolor(7);writeln('POZIOM TRUDNOSCI');writeln('INSTRUKCJA');write('WYJDZ');
- pokazMenu(1); if menuWybor=1 then goto koniec;clrscr;
- if menuWybor=3 then begin
- clrscr;menuWybor2:=4;
- textcolor(green);writeln('POZIOM TRUDNOSCI');textcolor(7);
- textcolor(red);writeln(' LATWY');textcolor(7);writeln('SREDNI');writeln('TRUDNY');writeln('MENU');
- pokazMenu(2);
- if menuWybor2=4 then begin trudnosc:=3;goto powrotDoMenu;end;
- if menuWybor2=3 then begin trudnosc:=2;goto powrotDoMenu;end;
- if menuWybor2=2 then begin trudnosc:=1;goto powrotDoMenu;end;
- if menuWybor2=1 then goto powrotDoMenu;
- end;
- if menuWybor=2 then begin instrukcja(22);instrwlwyl:=0;
- gotoxy(22,2);textbackground(white);textcolor(blue);write('Autorem gry jest Radoslaw Adamowicz');textcolor(7);
- textbackground(black);
- textcolor(red);gotoxy(22,19);write('Instrukcja dostepna po nacisniciu');
- gotoxy(22,19);write('klawisza k');textcolor(7);gotoxy(1,1);
- readkey;goto powrotDoMenu;end;
- clrscr;
- textcolor(red);gotoxy(53,2);writeln('Instrukcja - k');textcolor(7);
- {config}
- zycia:=5;
- bomby:=20;
- poziom:=1;
- mozliwychBomb:=3;{w jednym momencie mozna polozyc tyle bomb}{config_}
- tabPrawaZycia;
- ostByloBomb:=bomby;tabGoraBomby;
- gotoxy(18,21);write('Prosze czekac');textcolor(7+blink);write('...');textcolor(7);
- sciana;wyswietl(0);mapWzor;mapGenerator;ktoryPoziom;wyswietl(1);wyswietl(3);
- polozenieRestart;genPotwory(poziom);sprawdzPotwory;ostByloPotwo:=potwory;tabGoraPotwory;
- ktoryPoziom;jakiPoziomTrudnosci;
- dodamZycie:=0;{jezeli przejde 3 poziomy, dostaje zycie}
- REPEAT
- wznowGre:
- Timer;
- if jestAleZginal=1 then ileBomb:=0;{jezeli zgine, ale przedtem poloze bombe}
- if (czyZyje=0)AND(ileBomb=0) then begin zycia:=zycia-1;dodamZycie:=0;jestAleZginal:=0;goto restart;end;
- {(flaga)jezeli mnie nie widac i wybuchly bomby}
- jestAleZginal:=0;czyZyje:=1;
- if blokPauzy=1 then begin pauza: REPEAT odPauzuj:=readkey UNTIL (odPauzuj='p')OR(odPauzuj='P');gotoxy(1,1);
- textcolor(green);write('GRA WZNOWIONA');textcolor(7);potworyZaczekajcie;gotoxy(1,1);write(' ');
- gotoxy(1,1);goto wznowGre;end;
- idziesz:=readkey;
- case idziesz of
- 'w','W': begin if tab[i,j-1]<>('˛') then begin gotoxy(10+i,2+j);
- if tab[i,j]<>idbomby then begin tab[i,j]:=#176;write(tab[i,j]);end;ruch(i,j-1);j:=j-1;end;end;
- 's','S': begin if tab[i,j+1]<>('˛') then begin gotoxy(10+i,2+j);
- if tab[i,j]<>idbomby then begin tab[i,j]:=#176;write(tab[i,j]);end;ruch(i,j+1);j:=j+1;end;end;
- 'a','A': begin if tab[i-1,j]<>('˛') then begin gotoxy(10+i,2+j);
- if tab[i,j]<>idbomby then begin tab[i,j]:=#176;write(tab[i,j]);end;ruch(i-1,j);i:=i-1;end;end;
- 'd','D': begin if tab[i+1,j]<>('˛') then begin gotoxy(10+i,2+j);
- if tab[i,j]<>idbomby then begin tab[i,j]:=#176;write(tab[i,j]);end;ruch(i+1,j);i:=i+1;end;end;
- #13: begin if (bomby=0)AND(ileBomb=0) then goto restart; if ileBomb<mozliwychBomb then fbombki;end;
- 'k','K': begin instrukcja(42);end;{klawiszologia}
- 'l','L': begin wyswietlWyborPoziomu;pokazMenu(4);
- wyswietl(1);wyswietl(3);bomby:=20;polozenieRestart;genPotwory(poziom);ktoryPoziom;end;
- 'p','P': begin gotoxy(1,1);textcolor(red);write('PAUZA');textcolor(7);goto pauza;end;
- 'm','M': begin goto poczatek;end;
- 'r','R': begin goto restart;end;
- end;
- {jezeli wpadlem na potwora, wtedy restart (flaga)}
- if bylPotwor=1 then begin zycia:=zycia-1;goto restart;end;{koniec flagi}
- if (czyZyje=0)AND(ileBomb=0) then begin zycia:=zycia-1;dodamZycie:=0;goto restart;end;{(flaga)jezeli 0 to znaczy ze nie zyje}
- sprawdzPotwory;
- if (potwory=0) then begin dodamZycie:=dodamZycie+1;if dodamZycie mod 3=0 then zycia:=zycia+1;poziom:=poziom+1;sciana;restart:
- wyswietl(1);wyswietl(3);polozenieRestart;genPotwory(poziom);sprawdzPotwory;tabGoraPotwory;ktoryPoziom;
- bomby:=20;tabPrawaZycia;end;
- if zycia=0 then begin
- clrscr;menuWybor3:=2;
- textcolor(red);textcolor(green);writeln('Czy chcesz zagrac jeszcze raz?');textcolor(red);writeln(' TAK');textcolor(7);
- writeln('NIE');delay(1000);pokazMenu(3);
- if menuWybor3=2 then goto poczatek ELSE idziesz:='z';
- end;{funkcje sprawdzajace, czy zmienila sie ilosc bomb (dostepnych), potworow na mapie}
- if ostByloPotwo<>potwory then begin tabGoraPotwory;ostByloPotwo:=potwory;end;
- if ostByloBomb<>bomby then begin tabGoraBomby;ostByloBomb:=bomby;end;
- UNTIL (idziesz='z')OR(idziesz='Z')OR(poziom>10);
- clrscr;
- if poziom>10 then begin gotoxy(1,1);write('Gratuluje, przeszedles cala gre!');
- readkey;delay(3000);goto poczatek;end;
- UNTIL (idziesz='z')OR(idziesz='Z')OR(poziom>10);
- koniec:clrscr;write('Koniec gry');delay(2000);
- end.
Advertisement
Add Comment
Please, Sign In to add comment