Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- {Oh yeah ! F@!#$#@# text mode !!!!}
- program unknow;
- uses crt;
- const
- size1 = 2000;
- size2 = 1000;
- fout = 'record.dat';
- space = #32;
- type int = integer;
- rec = record
- m,n : int;
- end;
- arr = array[0..size1, 0..size1] of char;
- arr_rec = array[0..size2] of rec;
- var
- a : arr;
- k : char;
- n,xo,yo,d,answer : int;
- e : arr_rec;
- sec,score,kt,time,dems : int;
- function found(i,j:int; a:arr):boolean;
- begin
- if a[i,j]= space then found:=true
- else found:=false;
- end;
- procedure wall; {so luong buc tuong}
- var i,j,o:int;
- begin
- for i:=0 to 2000 do for j:=0 to 2000 do a[i,j]:=' ';
- textcolor(green); randomize;
- for o:=1 to 290 do
- begin
- repeat
- i:=random(80)+1;
- j:=random(24)+1;
- until (found(i,j,a));
- gotoxy(i,j); write('B');
- a[i,j]:='B';
- end;
- textcolor(8);
- end;
- procedure enemy;
- var i,j,o:int;
- begin
- textcolor(white);
- randomize;
- for o:=1 to 100 do {so luong quan dich}
- begin
- i:=1; j:=1;
- repeat
- i:=random(79)+1;
- j:=random(24)+1;
- until ( found(i,j,a))and(j<>1)and(i<>1);
- gotoxy(i,j); write('I');
- a[i,j]:='I';
- e[o].m:=i; e[o].n:=j;
- d:=40;
- end;
- textcolor(yellow);
- n:=o; d:=n;
- end;
- function clear( j,i:int):boolean;
- begin
- clear:=false;
- if (a[j,i]=' ')or(a[j,i]='x') then clear:=true;
- end;
- procedure commove;
- var i,x,y,j,l,jo,io,dem:int;
- begin
- randomize;
- if d=0 then exit;
- repeat
- i:=random(n)+1;
- x:=e[i].m; y:=e[i].n;
- until (a[x,y]<>'x')and(e[i].n<>0);
- x:=e[i].m; y:=e[i].n;
- if d>3 then j:=random(4)+1 else j:=random(8)+1;
- case j of
- 1 : if(y-1<>yo)and(a[x,y-1]<>'B')and(y-1>1)and(a[x,y-1]<>'I') then
- begin
- textcolor(red);
- gotoxy(x,y); write('I'); a[x,y]:=' ';
- textcolor(white);
- gotoxy(x,y-1); write('I'); a[x,e[i].n-1]:='I';
- e[i].m:=x; e[i].n:=e[i].n-1;
- end;
- 2 : if(y+1<>yo)and(a[x,y+1]<>'B')and(y+1<25)and(a[x,y+1]<>'I') then
- begin
- textcolor(red);
- gotoxy(x,y); write('I'); a[x,y]:=' ';
- textcolor(white);
- gotoxy(x,y+1); write('I'); a[x,e[i].n+1]:='I';
- e[i].m:=x; e[i].n:=e[i].n+1;
- end;
- 3 : if(x-1<>xo)and(a[x-1,y]<>'B')and(x-1>2)and(a[x-1,y]<>'I') then
- begin
- textcolor(red);
- gotoxy(x,y); write('I'); a[x,y]:=' ';
- textcolor(white);
- gotoxy(x-1,y); write('I'); a[e[i].m-1,y]:='I';
- e[i].m:=e[i].m-1; e[i].n:=y;
- end;
- 4 : if(x+1<>xo)and(a[x+1,y]<>'B')and(x+1<80)and(a[x+1,y]<>'I') then
- begin
- textcolor(red);
- gotoxy(x,y); write('I'); a[x,y]:=' ';
- textcolor(white);
- gotoxy(x+1,y); write('I'); a[e[i].m+1,y]:='I';
- e[i].m:=e[i].m+1; e[i].n:=y;
- end;
- end;
- end;
- procedure comfire;
- var i,x,y,j,l,jo,io,dem:int;
- begin
- if d=0 then exit;
- randomize;
- repeat
- i:=random(n)+1;
- x:=e[i].m; y:=e[i].n;
- until (a[x,y]<>'x')and(e[i].n<>0);
- x:=e[i].m; y:=e[i].n;
- l:=random(4)+1;
- case l of
- 1 : begin
- jo:=x;
- for dem:=1 to 5 do
- begin
- inc(jo);
- if (a[jo,y]='B')or(jo>79)or(a[jo,y]='I') then break;
- gotoxy(jo,y);
- textcolor(black);
- write('~'); delay(10);
- textcolor(red);
- gotoxy(jo,y); write('~');
- if (jo=xo)and(y=yo) then kt:=1;
- end;
- end;
- 2 : begin
- jo:=x;
- for dem:=1 to 5 do
- begin
- inc(jo,-1);
- if (a[jo,y]='B')or(jo<1)or(a[jo,y]='I') then break;
- gotoxy(jo,y);
- textcolor(black);
- write('~'); delay(10);
- textcolor(red);
- gotoxy(jo,y); write('~');
- if (jo=xo)and(y=yo) then kt:=1;
- end;
- end;
- 3 : begin
- io:=y;
- for dem:=1 to 2 do
- begin
- inc(io,1);
- if (a[x,io]='B')or(io>24)or(a[x,io]='I') then break;
- gotoxy(x,io);
- textcolor(black);
- write('~'); delay(10);
- textcolor(red);
- gotoxy(x,io); write('~');
- if (x=xo)and(io=yo) then kt:=1;
- end;
- end;
- 4 : begin
- io:=y;
- for dem:=1 to 2 do
- begin
- inc(io,-1);
- if (io=1)or(a[x,io]='B')or(a[x,io]='I') then break;
- gotoxy(x,io);
- textcolor(black);
- write('~'); delay(10);
- textcolor(red);
- gotoxy(x,io); write('~');
- if (x=xo)and(io=yo) then kt:=1;
- end;
- end;
- end;
- end;
- procedure delete(j,i:int);
- var dem:int;
- begin
- for dem:=1 to n do if (e[dem].m=j)and(e[dem].n=i)then
- begin
- e[dem].m:=0;
- e[dem].n:=0;
- exit;
- end;
- end;
- procedure movement(var i,j:int);
- var f,io,jo,fir,dem,mo:int;
- begin
- fir:=0; mo:=0; if (kt=1)or(d=0) then exit;
- repeat
- fir:=fir+1;
- inc(mo);
- if (mo=5)and(d>1) then begin commove; mo:=0; end
- else if (d=1) then if mo=28 then begin commove; mo:=0; end;
- dems:=dems+1;;
- delay(10);
- if fir=10 then begin comfire; fir:=0; end;
- if dems=80 then begin
- textcolor(yellow);
- inc(time); gotoxy(44,25); write(time);
- dems:=0;
- end;
- until keypressed;
- k:=readkey;
- case k of
- 'd' : begin
- jo:=j;
- for dem:=1 to 15 do
- begin
- inc(jo);
- if (a[jo,i]='B')or(jo=80) then break;
- gotoxy(jo,i);
- textcolor(black);
- write('.'); delay(10);
- textcolor(red);
- gotoxy(jo,i); write('.');
- if a[jo,i]='I' then begin a[jo,i]:='x'; d:=d-1; delete(jo,i); score:=score+3; end;
- commove;
- end;
- end;
- 'a' : begin
- jo:=j;
- for dem:=1 to 15 do
- begin
- inc(jo,-1);
- if (a[jo,i]='B')or(jo<1) then break;
- gotoxy(jo,i);
- textcolor(black);
- write('.'); delay(10);
- textcolor(red);
- gotoxy(jo,i); write('.');
- if a[jo,i]='I' then begin a[jo,i]:='x'; d:=d-1; delete(jo,i); score:=score+4;end;
- commove;
- end;
- end;
- 's' : begin
- io:=i;
- for dem:=1 to 10 do
- begin
- inc(io,1);
- if (a[j,io]='B')or(io=25) then break;
- gotoxy(j,io);
- textcolor(black);
- write('.'); delay(10);
- textcolor(red);
- gotoxy(j,io); write('.');
- if a[j,io]='I' then begin a[j,io]:='x'; d:=d-1; delete(j,io); score:=score+2;end;
- commove;
- end;
- end;
- 'w' : begin
- io:=i;
- for dem:=1 to 10 do
- begin
- inc(io,-1);
- if (io=0)or(a[j,io]='B') then break;
- gotoxy(j,io);
- textcolor(black);
- write('.'); delay(10);
- textcolor(red);
- gotoxy(j,io); write('.');
- if a[j,io]='I' then begin a[j,io]:='x'; d:=d-1; delete(j,io); score:=score+1;end;
- commove;
- end;
- end;
- 'M' : if(j<80)and(clear(j+1,i)) then begin
- textcolor(red);
- gotoxy(j,i); write('Y');
- j:=j+1; textcolor(yellow);
- gotoxy(j,i); write('Y');
- xo:=j; yo:=i;
- sec:=sec-1;
- if d>1 then commove;
- end;
- 'K' : if (j>1)and(clear(j-1,i))then begin
- textcolor(red);
- gotoxy(j,i); write('Y');
- textcolor(yellow);
- j:=j-1;
- gotoxy(j,i); write('Y');
- xo:=j; yo:=i;
- sec:=sec-1;
- if d>1 then commove;
- end;
- 'H' : if (i>1)and(clear(j,i-1)) then begin
- textcolor(red);
- gotoxy(j,i); write('Y');
- i:=i-1;
- textcolor(yellow);
- gotoxy(j,i); write('Y');
- xo:=j; yo:=i;
- sec:=sec-1;
- if d>1 then commove;
- end;
- 'P' : if (i<24)and(clear(j,i+1))then begin
- textcolor(red);
- gotoxy(j,i); write('Y');
- textcolor(yellow);
- i:=i+1;
- gotoxy(j,i); write('Y');
- xo:=j; yo:=i;
- sec:=sec-1;
- if d>1 then commove;
- end;
- end;
- commove;
- comfire; dems:=dems+1;
- if dems mod 20=0 then
- begin
- textcolor(yellow);
- inc(time); gotoxy(44,25); write(time);
- dems:=0;
- end;
- end;
- procedure play;
- var i,j,fake:int; f:text;
- begin
- wall;
- gotoxy(1,1);
- for i:=1 to 80 do begin write('*'); a[i,1]:='B'; end;
- for i:=1 to 25 do begin
- write('*'); a[1,i]:='B'; gotoxy(1,i);
- a[80,i]:='B';
- end;
- gotoxy(80,1);
- for i:=1 to 25 do begin
- write('*');
- gotoxy(80,i);
- end;
- textcolor(yellow);
- sec:=490; gotoxy(1,25); write('MOVE : ');
- score:=0; gotoxy(8,25); write(sec);
- gotoxy(20,25); write('SCORE : ');
- gotoxy(29,25); write(SCORE);
- gotoxy(38,25); write('TIME : ');
- gotoxy(44,25); write(time);
- enemy;
- gotoxy(2,2);
- write('Y');
- i:=2; j:=2; xo:=2; yo:=2;
- repeat
- movement(i,j);
- textcolor(yellow);
- gotoxy(8,25); write(sec);
- gotoxy(29,25); write(SCORE);
- until (k=#27)or(d=0)or(sec<=0)or(kt=1);
- assign(f,fout); reset(f); read(f,fake); close(f);
- if score>fake then begin
- assign(f,fout); rewrite(f);
- write(f,score);
- end;
- end;
- procedure head;
- begin
- writeln('Ok 1st you need to know is this game is f****** simple !');
- delay(1000);
- writeln('Use arrow keys to move and asdw to shot ');
- delay(1000);
- writeln('That is .... so f**** play it !');
- readln;
- clrscr;
- textcolor(green);
- gotoxy(34,1); write('T'); delay(200);
- gotoxy(35,1); write('H'); delay(200);
- gotoxy(36,1); write('E'); delay(200);
- gotoxy(38,1); write('H'); delay(200);
- gotoxy(39,1); write('U'); delay(200);
- gotoxy(40,1); write('N'); delay(200);
- gotoxy(41,1); write('T'); delay(200);
- gotoxy(42,1); write('E'); delay(200);
- gotoxy(43,1); write('R'); delay(200);
- gotoxy(45,1); write('G');delay(200);
- gotoxy(45,1); write('GA');delay(200);
- gotoxy(45,1); write('GAM');delay(200);
- gotoxy(45,1); write('GAME');delay(200);
- gotoxy(1,25); write('press ESC to quit ');
- gotoxy(35,2); Delay(600);
- repeat
- delay(650);
- write(' press enter ');
- Delay(679);
- gotoxy(35,2); clreol;
- until keypressed;
- textcolor(white);
- end;
- procedure menu ;
- var answer :char; x,y,po:int; f:text;
- ch :array[1..3] of string;
- begin
- ch[1]:='PLAY'; ch[2]:='OPTION'; ch[3]:='HIGH SCORE';
- textcolor(green);
- gotoxy(34,3); write('PLAY'); x:=34; y:=3; po:=1; {position}
- textcolor(white);
- gotoxy(34,4); write('OPTION dont click i''vent done yet');
- gotoxy(34,5); write('HIGH SCORE dont click i''vent done yet');
- repeat
- answer:=readkey;
- case answer of
- 'H': if y-1>=3 then begin
- gotoxy(x,y); textcolor(white); write(ch[po]);
- y:=y-1; po:=po-1;
- gotoxy(x,y); textcolor(green); write(ch[po]);
- end;
- 'P': if y+1<=5then begin
- gotoxy(x,y); textcolor(white); write(ch[po]);
- y:=y+1; po:=po+1;
- gotoxy(x,y); textcolor(green); write(ch[po]);
- end;
- end;
- until answer=' ';
- if y=3 then exit else
- if y=5 then
- begin
- assign(f,fout); reset(f);
- read(f,score); close(f);
- clrscr;
- gotoxy(35,5); write('YOUR SCORE : ',score);
- answer:=readkey; repeat until answer=' ';
- clrscr;
- menu;
- end;
- end;
- var i,j:int; t:char;
- begin
- repeat
- textbackground(black); textcolor(yellow); clrscr;
- for i:=1 to 25 do for j:=1 to 80 do begin write('Y'); end;
- clrscr; head; kt:=0; time:=0; t:=readkey; clrscr;
- if t=#27 then halt;
- menu; clrscr;
- textbackground(red); textcolor(green);
- for i:=1 to 25 do for j:=1 to 80 do begin write('B'); end;
- clrscr; textcolor(white);
- write(' Remember to press ESC while playing if u wanted to quit ! ');
- delay(1800);
- play; clrscr;
- textbackground(white);
- textcolor(red);
- for i:=1 to 25 do for j:=1 to 80 do begin write('I'); end;
- clrscr;
- textcolor(black);
- gotoxy(33,5); write('T'); delay(121);
- gotoxy(33,5); write('TH'); delay(121);
- gotoxy(33,5); write('THA'); delay(121);
- gotoxy(33,5); write('THAN'); delay(121);
- gotoxy(33,5); write('THANK'); delay(121);
- gotoxy(33,5); write('THANKS'); delay(121);
- gotoxy(33,5); write('THANKS F'); delay(121);
- gotoxy(33,5); write('THANKS FO'); delay(121);
- gotoxy(33,5); write('THANKS FOR '); delay(121);
- gotoxy(33,5); write('THANKS FOR P'); delay(121);
- gotoxy(33,5); write('THANKS FOR PL'); delay(121);
- gotoxy(33,5); write('THANKS FOR PLA'); delay(121);
- gotoxy(33,5); write('THANKS FOR PLAY'); delay(121);
- gotoxy(33,5); write('THANKS FOR PLAYI'); delay(121);
- gotoxy(33,5); write('THANKS FOR PLAYIN'); delay(121);
- gotoxy(33,5); write('THANKS FOR PLAYING'); delay(121);
- gotoxy(35,6); write('YOUR SCORE : ',score); delay(400);
- gotoxy(35,7); write('YOUR TIME : ',time); delay(400);
- gotoxy(36,8);
- gotoxy(1,25);
- write('press ESC to quit ');
- gotoxy(36,8);
- repeat
- delay(650);
- write(' press enter ');
- Delay(679);
- gotoxy(36,8); clreol;
- until keypressed;
- t:=readkey;
- until t=#27;
- end.
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement