Quote Originally Posted by Andreaz
After some more testing I'm considering ditching the TPHXEntity.Clone as a object construction method and use something like thise:

Code:
TPHXEntityDefinition = class
 private
  // Name of the entity definition
  FName: String;
 protected
  function AddImpl(const AParent: TPHXEntity): TPHXEntity; virtual; abstract;
 public
  // Create a new entity from this definition
  function Add(const AParent: TPHXEntity): TPHXEntity;

   // Name of the entity definition
  property Name: String read FName write FName;
 end;

constructor TPlayerDefinition.Create(SpriteImages: TPHXImageList);
begin
 Image    := SpriteImages.Find('Sprites/AncientCruiser');
 PatternIndex:= 0;
 ShipName  := 'Ancient Cruiser';
end;

function TPlayerDefinition.AddImpl(const AParent: TPHXEntity): TPHXEntity;
var Sprite: TPHXSprite;
begin
 Sprite:= TPHXSprite.Create(AParent);
 Result:= Sprite;

 Sprite.Image    := Image;
 Sprite.PatternIndex:= PatternIndex;
end;

and creating a player sprite:

Player:= PlayerDefinition.Add(nil) ;

and then you can retrieve the definition like this:

 TPlayerDefinition(Player.Definition).ShipName
This seems to be working
I don't know about this TPHXEntity.Clone function you're talking about. I can't find it in my version of Phoenix (2009-05-11 it's the latest public release right?)

I must admit I'm struggling to see the big point with a THPXEntityDefinition. It gives a nice structured way to create entities but is there more to it?

Quote Originally Posted by Andreaz
I've had some great progress over the last few days, i have a canvas demo to make and some more fine tuning on the sprites, and then its time for a more final release. I wont promise to much, but you might see it before the weekend!
Sounds good.