LoadSprite()

Syntax

Result = LoadSprite(#Sprite, Filename$ [, Mode])
Description
Load the specified sprite into memory for immediate use. A screen should be opened with OpenScreen() or OpenWindowedScreen() before loading a sprite.

The sprite can be in BMP format or any other format supported by the ImagePlugin library. The following functions can be used to enable automatically more image formats:

UseJPEGImageDecoder()
UseJPEG2000ImageDecoder()
UsePNGImageDecoder()
UseTIFFImageDecoder()
UseTGAImageDecoder()

Parameters

#Sprite A number to identify the new loaded sprite. #PB_Any can be used to auto-generate this number.
Filename$ Name of the image file used to create the sprite.
Mode (optional) It can be a combination of the following values (with the '|' operator):
  #PB_Sprite_PixelCollision: Add special information to handle pixel collision trough SpritePixelCollision().
  #PB_Sprite_AlphaBlending : Sprite is created with per pixel alpha-channel support, needed for DisplayTransparentSprite().
                            The image format has to support it (only PNG and TIFF for now).

Return value

Nonzero if the sprite has been loaded, zero otherwise. If #PB_Any was used for the #Sprite parameter then the generated number is returned on success.

Remarks

Sprites shouldn't be larger than the used screenmode. Using larger sprites possibly works on some hardware, on others not. Better split your large sprite to several smaller ones.

Supported OS

All

<- IsSprite() - Sprite Index - RotateSprite() ->