Results 1 to 4 of 4

Thread: delphix no animation

  1. #1

    delphix no animation

    i wanna make an animation
    so used this code
    but it doesn't work he only plays frame 1 so no animation what's wrong
    can some one help

    mitch

    [pascal] heli := Tback.Create(DXSpriteEngine1.Engine);
    heli.Image := Form1.DXImageList1.Items.Find('Pacman');
    heli.X := 10;
    heli.Y := 10;
    heli.Width := 28;
    heli.Height := heli.Image.Height;
    heli.AnimStart := 0;
    heli.AnimCount := 2;
    heli.AnimLooped := True;
    heli.AnimSpeed := 50/1000;[/pascal]

  2. #2

    delphix no animation

    I heard there are some bugs with animating sprites in delphix. I've never used that way of animation myself though. I'm using this in my tutorials

    [pascal]
    TPlayer = class(TImageSprite)
    protected
    startFrame : byte;
    CurrentFrame : byte;
    maxFrame : byte;
    procedure ChangeFrame;
    end;
    (....)
    var player : TPlayer;
    (....)
    procedure TPlayer.ChangeFrame;
    begin
    if GameCounter mod 4 = 0 then //inc gamecounter in ontimer event
    begin
    if CurrentFrame < startFrame+MaxFrame-1 then
    inc(CurrentFrame)
    else
    CurrentFrame:= StartFrame;
    end;

    image := Form1.DXImagelist1.items.items[CurrentFrame];
    end;

    (....)
    player := TPlayer.Create(Form1.DXSpriteEngine1.Engine);
    With player do
    begin
    Image := Form1.DXImageList1.Items.items[19];
    X := (form1.width - 15) div 2;
    Y := form1.Height - 50;
    Z := 10;
    Width := Image.Width;
    Height := Image.Height;
    startFrame := 19;
    CurrentFrame := startFrame;
    maxFrame := 10;
    end;

    [/pascal]

    Have a look at my the tutorials on my website for more info about this...[/pascal]

  3. #3

    delphix no animation

    Make sure you have set the PatternWidth and PatternHeight properties of the PictureCollectionItem ('Pacman') are set to the correct size. Then set the Width and Height of the sprite to the Width and Height of the image.
    [pascal]heli.Width := heli.Image.Width;
    heli.Height := heli.Image.Height;[/pascal]
    [size=10px][ Join us in #pgd on irc.freenode.net ] [ Sign the Petition for a Software Patent Free Europe ][/size]

  4. #4

    delphix no animation

    The first way is a bad way to animate - come collision detection time, it fails miserably. I'd use the Traveler's way.

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
  •