Скачиваний:
10
Добавлен:
15.06.2014
Размер:
1 Кб
Скачать
unit UTrap;

interface
uses graphics;
Type TTrap=class(TObject)
x,y,a,b:integer;
c:Tcolor;
can:Tcanvas;
constructor create(x0,y0,a0,b0:integer;c0:Tcolor;can0:Tcanvas);
procedure Show; virtual;
procedure Move(Dx:integer); virtual;
end;

implementation
constructor TTrap.create;
begin
inherited create;
x:=x0;
y:=y0;
a:=a0;
b:=b0;
c:=c0;
can:=can0
end;
procedure TTrap.Show;
begin
c:=clred;
can.Pen.Color:=c;
can.Brush.Color:=c;
with can do begin
moveto(x,y);
lineto(x-40,y+b);
lineto(x+a+40,y+b);
lineto(x+a,y);
lineto(x,y);
Floodfill(x+a-20,y+b-20,c,fsBorder)
end;
end;
procedure TTrap.Move(Dx:integer);
begin
c:=clBtnFace;
can.Brush.Color:=clOlive;
can.Pen.Color:=clBtnFace;
with can do begin
moveto(x,y);
lineto(x-40,y+b);
lineto(x+a+40,y+b);
lineto(x+a,y);
lineto(x,y);
Floodfill(x+a-20,y+b-20,c,fsBorder)
end;
x:=x+Dx;
show
end;

end.
Соседние файлы в папке машинка