Result = LoadSprite(#Sprite, Filename$ [, Mode])
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 any image format supported by the web browser.


#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 through SpritePixelCollision().
  #PB_Sprite_AlphaBlending : Sprite is created with per pixel alpha-channel support, needed for DisplayTransparentSprite().
                            The image format has to support it (PNG only for now).

Return value

Nonzero if the sprite has been created, zero otherwise. The sprite is still not loaded, the callbacks binded to #PB_Event_Loading and #PB_Event_LoadingError will be called once the loading is done. If #PB_Any was used for the #Sprite parameter then the generated number is returned on success.


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


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