Арканоид на Паскале

#13:begin cleardevice; exit; end;

end;

until false;

end;

procedure razmer_planki(var koeff:byte);

var s:string;

x1,y1,x2,y2:integer;

i:-1 1;

redvalue,bluevalue:0 63;

begin

setcolor(red);

s:='Adjust the size of a rod'{'отрегулируйте размер планки'};

settextstyle(4{GothicFont},horizdir,5);

settextjustify(1,1);

outtextxy(getmaxx div 2, getmaxy div 2, s);

i:=1;

redvalue:=0;

bluevalue:=0;

repeat

repeat

setRGBpalette(red,redvalue,bluevalue,0);

inc(bluevalue,i);

inc(redvalue,i);

until keypressed or (redvalue=0) or (redvalue=63);

i:=-i;

until keypressed;

cleardevice;

{рамка}

setcolor(random(14)+1);

rectangle(0,0,getmaxx,getmaxy);

{планка посередине}

setcolor(13);

setfillstyle(6,13);

koeff:=4;

x1:=round(getmaxx/2-(koeff/2)*shir-1);

y1:=getmaxy-1;

x2:=round(getmaxx/2+(koeff/2)*shir);

y2:=getmaxy-shir;

bar3d(x1,y1,x2,y2,0,false);

repeat

if keypressed then

case readkey of

#42{'*'}:if koeff<42 then

begin

inc(koeff);

x1:=round(getmaxx/2-(koeff/2)*shir-1);

y1:=getmaxy-1;

x2:=round(getmaxx/2+(koeff/2)*shir);

y2:=getmaxy-shir;

bar3d(x1,y1,x2,y2,0,false);

end;

#45{-}:if koeff>2 then

begin

setcolor(0);

setfillstyle(0,0);

x1:=round(getmaxx/2-(koeff/2)*shir-1);

y1:=getmaxy-1;

x2:=round(getmaxx/2+(koeff/2)*shir);

y2:=getmaxy-shir;

bar3d(x1,y1,x2,y2,0,false);

dec(koeff);

setcolor(13);

setfillstyle(6,13);

x1:=round(getmaxx/2-(koeff/2)*shir-1);

y1:=getmaxy-1;

x2:=round(getmaxx/2+(koeff/2)*shir);

y2:=getmaxy-shir;

bar3d(x1,y1,x2,y2,0,false);

end;

#13:exit;

end;

until false;

end;

procedure livs(var liv:byte;score:integer);

var s2:string;

begin

dec(liv);

naverhu_liv(liv);

if liv=0 then

begin

ochki(score);

s2:='You have lost !';

zastavka(s2);

closegraph;

halt;

end;

end;

procedure perehod_level(const numbering:byte);

var i,j:30 330;

s:string;

begin

str(numbering,s);

s:='level '+s;

cleardevice;

setcolor(14);

settextstyle(4{GothicFont},horizdir,5);

settextjustify(1,1);

outtextxy(getmaxx div 2, getmaxy div 2, s);

i:=30;

j:=280;

{while (i<>330) and (j<>30) do

begin

sound(i);

delay(100);

sound(j);

delay(100);

inc(i);

dec(j);

end;

nosound;}

delay(5000);

end;

procedure planka_sharik(koeff:byte);

var x1,y1,x2,y2,x,y:integer;

begin

{планка посередине}

setcolor(13);

setfillstyle(6,13);

x1:=round(getmaxx/2-(koeff/2)*shir-1);

y1:=getmaxy-1;

x2:=round(getmaxx/2+(koeff/2)*shir);

y2:=getmaxy-shir;

bar3d(x1,y1,x2,y2,0,false);

{шарик над планкой}

x:=getmaxx div 2;

y:=getmaxy-shir-radius-1;

setcolor(10);

circle(x,y,radius);

end;

procedure musik;

begin

{sound(460);

delay(130);

nosound;}

end;

procedure izchez_vv_niz(var dy:t_dx_dy;x,y,i:t_kubik;var a:t_arr;var kol_kub:kol_kubik;var score:integer);

var p:-3 494;

begin

p:=i-36;

while (i>=p) and not((y-radius+1=a[i+1]) or (y+radius-1=a[i+1]-20)) do

dec(i,2);

if i<0 then inc(i,2);

if (y-radius+1=a[i+1]) or (y+radius-1=a[i+1]-20) then

begin

setcolor(0);

setfillstyle(1,0);

bar3d(a[i],a[i+1],a[i]+48,a[i+1]-20,0,false);

musik;

a[i]:=0;

a[i+1]:=0;

dy:=-dy;

dec(kol_kub);

naverhu_kubiki(kol_kub,score);

end;

end;

procedure bok_bok(var dx:t_dx_dy;x,y:t_kubik;var a:t_arr;var kol_kub:kol_kubik;var score:integer);

var i:1 496;

begin

i:=1;

while i<=493 do

begin

if ((x+radius-1=a[i]) and (y<a[i+1]) and (y>a[i+1]-20)) or

((x-radius+1=a[i]+48) and (y<a[i+1]) and (y>a[i+1]-20)) then

begin

setcolor(0);

setfillstyle(1,0);

bar3d(a[i],a[i+1],a[i]+48,a[i+1]-20,0,false);

musik;

a[i]:=0;

a[i+1]:=0;

dx:=-dx;

dec(kol_kub);

musik;

naverhu_kubiki(kol_kub,score);

exit;

end;

inc(i,2);

end;

end;

procedure death;

var i:30 800;

begin

i:=800;

{while i<>30 do

begin

sound(i);

delay(10);

dec(i);

end;

nosound;}

end;

procedure zapis(const xs,ys:t_kubik;i:t_kubik;var a:t_arr);

begin

while a[i]<>0 do

inc(i,2);

a[i]:=xs;

a[i+1]:=ys;

end;

procedure level(var a:t_arr;const numbering:byte;var kol_kub:kol_kubik);

var xs,ys,i:t_kubik;

f:text;

color,pattern:byte;

number:string;

begin

for i:=1 to 494 do

a[i]:=0;

str(numbering,number);

assign(f,'levels\level'+number+'.den');

reset(f);

while not eof(f) do

begin

readln(f,xs,ys);

color:=random(14)+1;

pattern:=random(11)+1;

setcolor(color);

setfillstyle(pattern,color);

bar3d(xs,ys,48+xs,ys-20,0,false);

end;

close(f);

kol_kub:=0;

reset(f);

while not eof(f) do

begin

readln(f,xs,ys);

if xs<>0 then inc(kol_kub);

case xs of

1: begin i:=1; zapis(xs,ys,i,a); end;

50: begin i:=39; zapis(xs,ys,i,a); end;

99: begin i:=77; zapis(xs,ys,i,a); end;

148: begin i:=115; zapis(xs,ys,i,a); end;

197: begin i:=153; zapis(xs,ys,i,a); end;

246: begin i:=191; zapis(xs,ys,i,a); end;

295: begin i:=229; zapis(xs,ys,i,a); end;

344: begin i:=267; zapis(xs,ys,i,a); end;

393: begin i:=305; zapis(xs,ys,i,a); end;

442: begin i:=343; zapis(xs,ys,i,a); end;

491: begin i:=381; zapis(xs,ys,i,a); end;

540: begin i:=419; zapis(xs,ys,i,a); end;

589: begin i:=457; zapis(xs,ys,i,a); end;

end;

end;

close(f);

end;

procedure left(const koeff:byte;var x1_dv,x2_dv:t_kubik);

begin

if x1_dv-8 <= 0 then

begin

musik;

setcolor(0);

setfillstyle(0,0);

bar3d(x1_dv,y1_dv,x2_dv,y2_dv,0,false);

setfillstyle(6,13);

setcolor(13);

x1_dv:=1;

x2_dv:=koeff*shir;

bar3d(x1_dv,y1_dv,x2_dv,y2_dv,0,false);

end else

begin

setcolor(0);

setfillstyle(0,0);

bar3d(x1_dv,y1_dv,x2_dv,y2_dv,0,false);

setfillstyle(6,13);

setcolor(13);

dec(x1_dv,8);

dec(x2_dv,8);

bar3d(x1_dv,y1_dv,x2_dv,y2_dv,0,false);

end;

end;

procedure right(const koeff:byte;var x1_dv,x2_dv:t_kubik);

begin

if x2_dv+8 >= getmaxx then

begin

musik;

setcolor(0);

setfillstyle(0,0);

bar3d(x1_dv,y1_dv,x2_dv,y2_dv,0,false);

setfillstyle(6,13);

setcolor(13);

x2_dv:=getmaxx-1;

x1_dv:=x2_dv-koeff*shir;

bar3d(x1_dv,y1_dv,x2_dv,y2_dv,0,false);

end else

begin

setcolor(0);

setfillstyle(0,0);


Страница: