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

settextstyle(7{GothicFont},horizdir,2);

settextjustify(1,1);

outtextxy(getmaxx div 2,5,s);

setYrange(21,420);

setXrange(1,637);

assign(f,'level.den');

rewrite(f);

x:=10;y:=10;

setmouseXY(x,y);

x_pred:=0;

mouseon;

repeat

getmouseXY(x,y,lb,rb,tb);

if lb then begin

mouseoff;

if x<>x_pred then

case x of

1 49: begin x:=1; search_y; end;

50 98: begin x:=50; search_y; end;

99 147:begin x:=99; search_y; end;

148 196:begin x:=148; search_y; end;

197 245:begin x:=197; search_y; end;

246 294:begin x:=246; search_y; end;

295 343:begin x:=295; search_y; end;

344 392:begin x:=344; search_y; end;

393 441:begin x:=393; search_y; end;

442 490:begin x:=442; search_y; end;

491 539:begin x:=491; search_y; end;

540 588:begin x:=540; search_y; end;

589 637:begin x:=589; search_y; end;

end;

x_pred:=x;

mouseon; end;

until rb;

setfillstyle(1,black);

bar(4,getmaxy div 5-8,130,getmaxy div 5 +300+20);

setcolor(yellow);

s:='Save as: ';

spusk:=getmaxy div 5;

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

settextjustify(lefttext,centertext);

outtextxy(4,spusk,s);

for number:=1 to 10 do

begin

inc(spusk,30);

str(number,s_l);

s:='Level '+s_l;

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

settextjustify(lefttext,centertext);

outtextxy(4,spusk,s);

end;

close(f);

repeat

if keypressed then

begin

s:=readkey;

val(s,number,code);

case number of

0:begin

assign(f_s,'levels\level10.den');

erase(f_s);

rename(f,'levels\level10.den');

exit;

end

else if number in [1 9] then

begin

assign(f_s,'levels\level'+s+'.den');

erase(f_s);

rename(f,'levels\level'+s+'.den');

exit;

end;

end;

end;

until false;

end;

var j:1 494;

begin

{for j:=1 to 494 do

a[j]:=0;}

i:=1;

randomize;

text_na_ekran;

initgr;

build_level;

mouseoff;

closegraph;

end.

Список используемой литературы:

1) Ян Белецкий «Турбо Паскаль с графикой для персональных компьютеров»

2) Walasek J.Konwersacyjne otoczenie programowe Pascala. WNT, Warsawa

3) Turbo Tutor. Borland International. Scotts Valley, California

4) Cherry G. Pascal Programming Structures. Reston Publishing Company. Reston, Virginia


Страница: