Skip to content

CreateSprite

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

CreateSprite

CreateSprite:Int32 parent:Int32=0
Parameter Mode Type Default Description
parent In Int32 0 Optional parent entity.

Returns: An entity handle for the sprite.

Description

Creates a sprite: a flat square of two triangles that extends from -1, -1 to 1, 1 around its position. A sprite has no mesh to edit, so it is very cheap and suited to particles, lens flares, trees in the distance and 2D games drawn in 3D. By default a sprite turns to face the camera, see SpriteViewMode, so a round texture makes it look like a sphere from every side.

Sprites have their own commands for scale, rotation and handle: ScaleSprite, RotateSprite and HandleSprite. A new sprite is full-bright (EntityFX flag 1) and not lit. EntityFX replaces all flags, so EntityFX sprite, 0 lights it, which a sprite without normals does by ambient light alone. Everything else, such as position, texture and color, works as for any entity.

A parent makes the sprite follow another entity. The sprite is still created at 0, 0, 0, not at the parent's position.

Examples

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

; A texture of a soft red disc on black.
tex = CreateTexture(64, 64, 1 + 4096)
SetBuffer TextureBuffer(tex)
ClsColor 0, 0, 0
Cls
For i = 0 To 12
	Color 255 - i * 14, 40 + i * 4, 40
	Oval 2 + i * 2, 2 + i * 2, 60 - i * 4, 60 - i * 4, 1
Next
SetBuffer BackBuffer()

For i = 0 To 4
	sprite = CreateSprite()
	EntityTexture sprite, tex
	PositionEntity sprite, -4 + i * 2, 0, 8
	ScaleSprite sprite, 0.4 + i * 0.2, 0.4 + i * 0.2
Next
RenderWorld
Flip
WaitKey

Media

CreateSprite

Related Commands

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

Home · Command Index



Differences
Language Features
BlitzBasic
Blitz3D
BlitzPlus

Clone this wiki locally