Uses Graph, CRT; Type TSetGraph = Object xst, yst, xfn, yfn: Integer; Procedure Init(pxst, pySt, pxfn, pyfn: Integer); Procedure Hide; Procedure Show(Color: Integer); Procedure Move(pxst, pySt, pxfn, pyfn: Integer); End; Procedure TSetGraph.Init(pxst, pySt, pxfn, pyfn: Integer); Begin xst := pxst; xfn := pxfn; yst := pyst; yfn := pyfn; End; Procedure TSetGraph.Hide; Begin Setcolor(Black); Rectangle(xst, yst, xfn, yfn) End; Procedure TSetGraph.Show; Begin SetColor(Color); Rectangle(xst, yst, xfn, yfn) End; Var d,r: Integer;{px1,px2,py1,py2,pcolor: integer;} pColor: Integer; Procedure TSetGraph.Move; Begin Hide; Inc(xst, pxst); Inc(xfn, pxfn); Inc(yst, pyst); Inc(yfn, pyfn); Show(pColor); end; Var sg: TSetGraph; begin d:=detect; initgraph(d,r,''); sg.Init( (GetMaxX div 5)*3, (GetMaxY div 5)*3, 4*(GetMaxX div 5)*3, 4*(GetMaxY div 5)*3); pColor:=3; sg.show(pColor); repeat begin if keypressed then begin case readkey of #77: sg.move(1,0,1,0); #75: sg.move(-1,0,-1,0); #80: sg.move(0,1,0,1); #72: sg.move(0,-1,0,-1); end end end until readkey=#27; closegraph; end.