unit mKugel;

interface

uses mSuM;

type Kugel = class
       hatStift: Stift;         // die Kugel hat einen Stift, um sich zu zeichnen
       constructor init;
       procedure   Zeichne;
       procedure   Loesche;
       procedure   Bewege;
       function    hPosition: Zahl;              // Anfrage mit Ergebnistyp Zahl
       procedure   setzeRichtung(pWinkel: Zahl); // Auftrag mit Parameter
       destructor  gibFrei;
     end;

implementation

constructor Kugel.init;
begin
  hatStift := Stift.init;       // Stift erzeugen
  hatStift.bewegeBis(20,50);
end;

procedure   Kugel.Zeichne;
begin
  hatStift.zeichneKreis(5);
end;

procedure   Kugel.loesche;
begin
  hatStift.radiere;
  self.Zeichne;
  hatStift.normal
end;

procedure   Kugel.Bewege;
begin
  self.loesche;
  hatStift.bewegeUm(0.1);       // an die Geschwindigkeit des Rechners anpassen!
  self.Zeichne;
end;

function    Kugel.hPosition: Zahl;
begin
  result:=hatStift.hPosition
end;

procedure   Kugel.setzeRichtung(pWinkel: Zahl);
begin
  hatStift.dreheBis(pWinkel)
end;

destructor  Kugel.gibFrei;
begin
  hatStift.gibFrei;             // Stift wieder freigeben
end;

end.