AGB  ·  Datenschutz  ·  Impressum  







Anmelden
Nützliche Links
Registrieren
Thema durchsuchen
Ansicht
Themen-Optionen

Pacman

Ein Thema von Blubbel · begonnen am 8. Feb 2012 · letzter Beitrag vom 14. Feb 2012
 
Blubbel

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

AW: Pacman

  Alt 8. Feb 2012, 14:47
Delphi-Quellcode:
 //Spieler und Monster
  TphItem = class(TObject)
  private
    FName: String;
    FSize: Integer;
    FPosition: TPoint;
    procedure GetName(const Value: String);
    procedure GetSize(const Value: Integer);
    procedure GetPosition(const Value: TPoint);
  public
    constructor Create();
    destructor Destroy();
    property Name: String read FName write GetName;
    property Size: Integer read FSize write GetSize;
    property Position: TPoint read FPosition write GetPosition;
  end;

  //Spielfigur
  TphPlayer = class(TphItem)
  private
  
  public
    constructor Create();
    destructor Destroy();
  end;

  //Gegner (Monster)
  TphMonster = class(TphItem)
  private

  public
    procedure Draw(ACanvas: TCanvas);
    constructor Create();
    destructor Destroy();
  end;


.........................


TphGameField = class(TObject)
  private
    FArray: Array of Array of Byte;
    FPlayer: TphPlayer;
    FMonsters: TObjectList;
    FViewPort: TphViewPort;
    FSize: Integer;
    FPosition: TPoint;
    FCount: Integer;
    FMonsterArray: Array [0..20] of TphMonster;
    procedure SetPosition(const Value: TPoint);
  protected
    function InitArray(AWidth, AHeight: Integer): Boolean;
  public
    constructor Create(AWidth, AHeight, ASize: Integer);
    destructor Destroy(); override;
    function MovePlayer(ADirection: Byte): TPoint; //????????????????????????
    procedure DrawGameField(ACanvas: TCanvas; AClipRect: TRect);
    procedure DrawPlayer(ACanvas: TCanvas);
    procedure DrawMonsters(ACanvas: TCanvas);
    property Player: TphPlayer read FPlayer {write SetPlayer};
    property ViewPort: TphViewPort read FViewPort {write SetViewPort};
    Property Position: TPoint read FPosition write SetPosition;
  end;
  Mit Zitat antworten Zitat
 


Forumregeln

Es ist dir nicht erlaubt, neue Themen zu verfassen.
Es ist dir nicht erlaubt, auf Beiträge zu antworten.
Es ist dir nicht erlaubt, Anhänge hochzuladen.
Es ist dir nicht erlaubt, deine Beiträge zu bearbeiten.

BB-Code ist an.
Smileys sind an.
[IMG] Code ist an.
HTML-Code ist aus.
Trackbacks are an
Pingbacks are an
Refbacks are aus

Gehe zu:

Impressum · AGB · Datenschutz · Nach oben
Alle Zeitangaben in WEZ +1. Es ist jetzt 13:35 Uhr.
Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
LinkBacks Enabled by vBSEO © 2011, Crawlability, Inc.
Delphi-PRAXiS (c) 2002 - 2023 by Daniel R. Wolf, 2024-2025 by Thomas Breitkreuz