Results 1 to 3 of 3

Thread: Creating sprites at runtime...

  1. #1

    Creating sprites at runtime...

    For example....

    --------------------

    type

    TPlayer = class(TImageSprite);
    .......
    var
    MainPlayer : Tplayer;
    ....
    procedure init;
    begin
    MainPlayer:=tplayer.create(form1.DXSpriteEngine.en gine); ??
    end;
    -------------------

    I can't seem to use "MainPlayer.tplayer.create(self)", so what should it be? It works as above, but wondered if it was correct

  2. #2

    Creating sprites at runtime...

    Yes, that is right. The parameter is supposed to be the "parent" of the sprite, so obviously it cannot be it's own parent. The Engine is the "root" sprite, so all your sprites will be a "child" of that (or the child of a child, etc.)
    [size=10px][ Join us in #pgd on irc.freenode.net ] [ Sign the Petition for a Software Patent Free Europe ][/size]

  3. #3

    Creating sprites at runtime...

    Quote Originally Posted by Useless Hacker
    Yes, that is right. The parameter is supposed to be the "parent" of the sprite, so obviously it cannot be it's own parent. The Engine is the "root" sprite, so all your sprites will be a "child" of that (or the child of a child, etc.)
    Thanks for the quick reply.

    I just wanted to check because if I create 100+ sprites this way I seem to get a lot of system crashes when I close the application.

    So in the end I decided not to use sprites and draw them myself but I'm using the above for around 8 others.

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •