Skip to content

LoadSprite

Narta Xaymar Dirks edited this page Oct 28, 2026 · 8 revisions
Blitz3D

LoadSprite

LoadSprite:Int32 file:String, texture_flags:Int32=1, parent:Int32=0
Parameter Mode Type Default Description
file In String required
texture_flags In Int32 1
parent In Int32 0 Optional parent entity.

Returns: An entity handle for the sprite, or 0 if the file could not be loaded.

Description

Creates a sprite and gives it a texture loaded from a picture file in one step. The sprite is drawn without lighting. How it blends depends on the flags: with the masked flag (4) it is drawn without blending and the black cut away, with the alpha flag (2) it is blended by its alpha, otherwise it is added to what is behind it, which suits glows and flares.

Examples

Graphics3D 320, 240, 0, 2
SetBuffer BackBuffer()
camera = CreateCamera()
CameraClsColor camera, 40, 50, 90

; Make a file of a yellow star on black, then load it as a sprite with the black cut away.
src = CreateTexture(64, 64, 1 + 4096)
SetBuffer TextureBuffer(src)
ClsColor 0, 0, 0
Cls
Color 255, 220, 60
For i = 0 To 28
	Rect 32 - i, 32 - (28 - i) / 3, i * 2, (28 - i) / 3 * 2 + 1, 1
Next
Oval 18, 18, 28, 28, 1
SaveBuffer TextureBuffer(src), "wiki_star.bmp"
SetBuffer BackBuffer()

sprite = LoadSprite("wiki_star.bmp", 1 + 4)
PositionEntity sprite, 0, 0, 5
ScaleSprite sprite, 2, 2
RenderWorld
Flip
WaitKey

Media

LoadSprite

Related Commands

CreateSprite, HandleSprite, RotateSprite, ScaleSprite, SpriteDepthFade 〔BlitzLLVM〕, SpriteViewMode

Home · Command Index



Differences
Language Features
BlitzBasic
Blitz3D
BlitzPlus

Clone this wiki locally