CreateAnimSprite

Syntax:

CreateAnimSprite( AnimSprite , Sprite , FrameX , FrameY [, Delay] )

Parameters:

AnimSprite

=

Variable as Type .AnimSprite

Sprite

=

the original PureBasic Sprite from which the AnimSprite is created.

FrameX

=

X-Size of 1 Frame in the Anim

FrameY

=

Y-Size of 1 Frame in the Anim

[Delay]

=

optional: Delay between Frames in milliseconds for automatic animation (0-60.000).


Return Values:

true

=

success

#false

=

failed


Description:

This Command creates an AnimSprite out of a PureBasic Sprite.


Example:

  LoadSprite(1,"big.bmp",0)
  TransparentSpriteColor(1,255,0,255)
  CreateAnimSprite(big.AnimSprite,1,75,75)

  ;
  ; plays the animation automatically
  ; without calling NextAnimFrame
  ; because the delay time is specified
  ; at creation time
  ;
  LoadSprite(1,"automatic.bmp",0)
  TransparentSpriteColor(1,255,0,255)
  CreateAnimSprite(automatic.AnimSprite,1,75,75, 40)
  ; 25 FPS  =  1000/25  =  Delay 40 ms
  ; 50 FPS  =  1000/50  =  Delay 20 ms
  
  ; game loop
  Repeat
    DisplayAnimSprite(automatic,100,100)
  Until ...

Remarks:

The optional 'Delay' parameter can be used to automate the animation.

Delay can be set to values between 0 and 60.000.

If set to 0, no animation is played automatically (default). Values between

1 and 60.000 specify the delay between each frame in the AnimSprite

in milliseconds.


Image:

AnimSprite:




Supported OS:   Windows, Linux