Добавил:
Upload
Опубликованный материал нарушает ваши авторские права? Сообщите нам.
Вуз:
Предмет:
Файл:Все лабораторные работы по паскалю / 9 лаб. Графика / Program1
.pas uses graphABC,crt;
var i,c,fon,x,y,ky,kx,z,r,yq,yw,xq,xw: integer;
q: char;
begin
fon:=RGB(0,0,0);
ClearWindow(fon);
ky:=1; kx:=1; z:=5; r:=10; yq:=150; yw:=150;
c:=RGB(255,255,0);
SetPenColor(c);
SetBrushColor(c);
SetWindowCaption('моя игра');
HideCursor;
SetPenWidth(6);
SetPenColor(RGB(255,100,50));
xq:=WindowWidth-1;
xw:=WindowWidth-1;
line(xq,yq,xw,yq+yw);
x:=1+random(WindowWidth);
y:=1+random(WindowHeight);
repeat
repeat
SetPenColor(fon); SetBrushColor(fon);
circle(x,y,r);
if y>=WindowHeight then ky:=-1;
if y<=0 then ky:=1;
if x>=WindowWidth-16 then
begin
if (y>yq )and(y<yq+yw ) then kx:=-1
else break;
end;
if x>=WindowWidth-16 then
begin
if (y>yq )and(y<yq+yw ) then
SetPenWidth(6);
SetPenColor(fon);
line(xq,yq,xw,yq+yw);
SetPenColor(RGB(255,100,50));
yw:=yw-15;
line(xq,yq,xw,yq+yw);
end;
if x<=0 then kx:=1;
y:=y+ky; x:=x+kx;
SetPenColor(c);
SetBrushColor(c);
circle(x,y,r);
delay(4);
until keypressed;
SetPenWidth(6);
SetPenColor(fon);
line(xq,yq,xw,yq+yw);
q:=readkey;
if q='8' then yq:=yq-10;
if q='2' then yq:=yq+10;
SetPenColor(RGB(255,100,50));
line(xq,yq,xw,yq+yw);
until q=' ';
end.
var i,c,fon,x,y,ky,kx,z,r,yq,yw,xq,xw: integer;
q: char;
begin
fon:=RGB(0,0,0);
ClearWindow(fon);
ky:=1; kx:=1; z:=5; r:=10; yq:=150; yw:=150;
c:=RGB(255,255,0);
SetPenColor(c);
SetBrushColor(c);
SetWindowCaption('моя игра');
HideCursor;
SetPenWidth(6);
SetPenColor(RGB(255,100,50));
xq:=WindowWidth-1;
xw:=WindowWidth-1;
line(xq,yq,xw,yq+yw);
x:=1+random(WindowWidth);
y:=1+random(WindowHeight);
repeat
repeat
SetPenColor(fon); SetBrushColor(fon);
circle(x,y,r);
if y>=WindowHeight then ky:=-1;
if y<=0 then ky:=1;
if x>=WindowWidth-16 then
begin
if (y>yq )and(y<yq+yw ) then kx:=-1
else break;
end;
if x>=WindowWidth-16 then
begin
if (y>yq )and(y<yq+yw ) then
SetPenWidth(6);
SetPenColor(fon);
line(xq,yq,xw,yq+yw);
SetPenColor(RGB(255,100,50));
yw:=yw-15;
line(xq,yq,xw,yq+yw);
end;
if x<=0 then kx:=1;
y:=y+ky; x:=x+kx;
SetPenColor(c);
SetBrushColor(c);
circle(x,y,r);
delay(4);
until keypressed;
SetPenWidth(6);
SetPenColor(fon);
line(xq,yq,xw,yq+yw);
q:=readkey;
if q='8' then yq:=yq-10;
if q='2' then yq:=yq+10;
SetPenColor(RGB(255,100,50));
line(xq,yq,xw,yq+yw);
until q=' ';
end.