Thema: Delphi Undefinierter Bezeichner

Einzelnen Beitrag anzeigen

hansdieter11

Registriert seit: 26. Feb 2009
41 Beiträge
 
#14

Re: Undefinierter Bezeichner

  Alt 10. Jan 2010, 19:02
Delphi-Quellcode:
unit mtRaumschiff;

interface

  type
    TRaumschiff = class
     public
      x:integer;
      y:integer;
      vx:integer;
      constructor Create;
      property xCoord:integer read x write x;
      property yCoord:integer read y write y;
      function getY:integer;
      function getX:integer;
      procedure GoRight;
     end;
     
implementation

constructor TRaumschiff.Create;
begin
  x := -50;
  vx := Random(7)+5;
  y := Random(60)+5;
end;

function TRaumschiff.getX:integer;
begin
  x := x+vx;
  result := x;
end;

function TRaumschiff.getY:integer;
begin
  result := y;
end;

procedure TRaumschiff.GoRight;
begin
  xCoord := xCoord + 10;
end;

end.
Delphi-Quellcode:
unit mtKugel;

interface

uses
  mtKanone;

  type
    TKugel = class
     public
      y:integer;
      x:integer;
      vy:integer;
      vx:integer;
      constructor Create;
      property yCoord:integer read y write y;
      property xCoord:integer read x write x;
      function getY:integer;
      function getX:integer;
      procedure GoUp;
      destructor Destroy; override;
     end;

implementation

constructor TKugel.Create;
begin
 vy := 10;
 yCoord := 520;
end;

destructor TKugel.Destroy;
begin
  //
end;

function TKugel.getY:integer;
begin
  y := y-vy;
  result := y;
end;

function TKugel.getX:integer;
begin
  result := x;
end;

procedure TKugel.GoUp;
begin
  yCoord := getY;
end;

end.
  Mit Zitat antworten Zitat