Thema: Pacman

Einzelnen Beitrag anzeigen

Blubbel

Registriert seit: 6. Okt 2011
125 Beiträge
 
Delphi 2010 Professional
 
#3

AW: Pacman

  Alt 8. Feb 2012, 11:40
einen Cade gibt es nur "indirekt" habe ein altes projekt ausgekramt und als vorlage benutzt und hat nicht viel geholfen. Bin ein zimlicher neuling. Vor allem sollen sie ja auch zufällig gezeichnet werden.

Also hier ist der Code den ich als vorlage genommen und schon verändert hab.
Delphi-Quellcode:
  for i := 0 to high(Self.FMonsterArray) do
  begin
    if assigned(Self.FMonsterArray[i]) then
    begin

      lRect.TopLeft.X := Self.FMonsterArray[i].Position.X;
      lRect.TopLeft.Y := Self.FMonsterArray[i].Position.Y;

      lRect.BottomRight.X := (lRect.TopLeft.X + 16);
      lRect.BottomRight.Y := (lRect.TopLeft.Y + 16);

      if Self.FCount <= High(Self.FMonsterArray) then
      begin
        Self.FMonsterArray[Self.FCount] := TphMonster.Create;
        Self.FMonsterArray[Self.FCount].Position := Point(random(GetWidth(ACanvas.ClipRect)), random(GetHeight(ACanvas.ClipRect)));
         Self.FCount := (Self.FCount +1);
      end;
      ACanvas.Ellipse(lRect.TopLeft.X, lRect.TopLeft.Y, lRect.BottomRight.X, lRect.BottomRight.Y);
    end;
  end;

Geändert von Blubbel ( 8. Feb 2012 um 11:43 Uhr)
  Mit Zitat antworten Zitat