Learn BLITZ3D with Real Code Examples
Updated Nov 24, 2025
Code Sample Descriptions
1
Blitz3D Simple Counter Example
Graphics3D 800,600
Text 0,0,"Count: 0"
count = 0
While Not KeyDown(1) 'Esc key
If KeyDown(203) Then count = count - 1 'Left arrow
If KeyDown(205) Then count = count + 1 'Right arrow
Cls
Text 100,100,"Count: " + count
Flip
Wend
A minimal Blitz3D example showing a counter and updating it using keyboard input.
2
Blitz3D Player Movement Example
Graphics3D 800,600
player = CreateCube()
PositionEntity player, 0,0,0
speed = 0.1
While Not KeyDown(1)
If KeyDown(203) Then MoveEntity player,-speed,0,0
If KeyDown(205) Then MoveEntity player,speed,0,0
If KeyDown(200) Then MoveEntity player,0,0,-speed
If KeyDown(208) Then MoveEntity player,0,0,speed
RenderWorld
Flip
Wend
Move a 3D player cube with arrow keys.
3
Blitz3D Simple Shooting Example
Graphics3D 800,600
player = CreateCube()
PositionEntity player,0,0,0
projectiles = CreateList()
While Not KeyDown(1)
If KeyDown(57) Then 'Space
p = CreateCube()
PositionEntity p,EntityX(player),0,EntityZ(player)
AddToList projectiles,p
End If
For i=0 To ListCount(projectiles)-1
MoveEntity ListValue(projectiles,i),0,0,0.2
Next
RenderWorld
Flip
Wend
Press space to shoot a cube projectile.
4
Blitz3D Simple Gravity Example
Graphics3D 800,600
cube = CreateCube()
PositionEntity cube,0,10,0
ySpeed = 0
gravity = 0.01
While Not KeyDown(1)
ySpeed = ySpeed + gravity
MoveEntity cube,0,ySpeed,0
If EntityY(cube) > 0 Then
PositionEntity cube,0,0,0
ySpeed = 0
End If
RenderWorld
Flip
Wend
Applies gravity to a cube.
5
Blitz3D Enemy Follow Example
Graphics3D 800,600
player = CreateCube() enemy = CreateCube()
PositionEntity player,0,0,0
PositionEntity enemy,5,0,5
speed = 0.05
While Not KeyDown(1)
xDir = EntityX(player)-EntityX(enemy)
zDir = EntityZ(player)-EntityZ(enemy)
MoveEntity enemy,xDir*speed,0,zDir*speed
RenderWorld
Flip
Wend
Enemy cube follows the player cube.
6
Blitz3D Simple Timer Example
Graphics3D 800,600
time = Timer()
While Not KeyDown(1)
If Timer()-time > 1000 Then
Print "1 second passed"
time = Timer()
End If
Flip
Wend
Prints a message every second.
7
Blitz3D Collision Detection Example
Graphics3D 800,600
cube1 = CreateCube()
cube2 = CreateCube()
PositionEntity cube1,0,0,0
PositionEntity cube2,1,0,0
While Not KeyDown(1)
If EntityCollides(cube1,cube2) Then
Print "Collision!"
End If
RenderWorld
Flip
Wend
Detects collision between two cubes.
8
Blitz3D Random Movement Example
Graphics3D 800,600
cube = CreateCube()
PositionEntity cube,0,0,0
While Not KeyDown(1)
MoveEntity cube,Rnd(-0.1,0.1),0,Rnd(-0.1,0.1)
RenderWorld
Flip
Wend
Moves a cube randomly each frame.
9
Blitz3D Simple Animation Example
Graphics3D 800,600
cube = CreateCube()
frames = [LoadImage("1.png"),LoadImage("2.png"),LoadImage("3.png")]
i = 0
timer = 0
While Not KeyDown(1)
timer = timer + 1
If timer Mod 10 = 0 Then
EntityTexture cube,frames(i)
i = (i+1) Mod 3
End If
RenderWorld
Flip
Wend
Cycles through textures to animate a cube.
10
Blitz3D Simple UI Text Example
Graphics3D 800,600
Text 100,100,"Hello Blitz3D"
While Not KeyDown(1)
Flip
Wend
Displays text on screen.