sprite=LoadAnimImage3D(file$,framesX[,framesY][,flags][,parent])

Parameters

file$ - filename of image file to be used
framesX - number of frames horizontally in animation file
framesY (optional) - number of frames vertically in animation file (Default=1l)

flags (optional):
1: Color
2: Alpha
4: Masked *
8: Mipmapped
16: Clamp U
32: Clamp V
64: Spherical reflection map
128: <void>
256: Store texture in vram
512: Force the use of high color textures

* Default

parent (optional) - give an alternative entity in which to attach the sprite to
By default the parent is the pivot as created by:
SpriteGraphics3D or CreateSpritePivot()

Description

Creates a quad entity from an animation image file.
The entity is then attached to the sprite pivot (or parent if supplied).

To set up the animation correctly just specify the amount of frames horizontally (and vertically if more than 1) when loading the animation.

Example:

This is how you would load the following12 frame animation file:

myanim.bmp

01 02 03 04
05 06 07 08
09 10 11 12

sprite=LoadAnimImage("myanim.bmp",4,3)

The sprites width is scaled to the pixel width of the image file divided by the number of frames in specified in framesX.
The sprites height is scaled to the pixel height of the image file divided by the number of frames in specified in framesY.

The number of frames should be at least 2.

To change/update the sprites animation frames use the DrawImage3D command. This has an optional 'frame' parameter.
The frame range is 1 to total_frames. You can use any value for the frame number. SpriteControl wraps the value automatically.

The optional flags parameter can be used to apply different effects to the texture. Default value is 4.

* NOTE: It is important to initialise the sprite display system first!
See SpriteGraphics3D or CreateSpritePivot()

Alternatively, you might want to attach the sprite to your own pivot/entity.
If so, just pass it's handle to the optional parent parameter.

*IMPORTANT*
Avoid using NameEntity on your animated sprite!
SpriteControl stores information regarding the animation settings here.
Any sprites sharing the texture will also be affected by animation changes.

See Also: FreeImage3D

Example

Include "Sprite Control.bb"

SpriteGraphics3D 640,480

framesAcross=6 ; 6 columns of images
framesDown=2 ; 2 rows of images
TOTALFRAMES=framesAcross*framesDown

mysprite=LoadAnimImage3D("myimage.bmp",TOTALFRAMES)

Repeat
framenumber=framenumber+1
If framenumber>TOTALFRAMES Then framenumber=0
DrawImage3D mysprite,120,100,framenumber

RenderWorld
Flip
Until KeyHit(1)

End


Index