Graphics3D 640, 480, 16, 2
SetBuffer BackBuffer()
c = CreateCamera()
l = CreateLight()
PositionEntity c, 300,300,-300
RotateEntity c, 45,45,0
Ox = CreateCube()
PositionEntity Ox, 0,0,0
ScaleEntity Ox, 1000,1,1
EntityColor Ox, 255,255,255
Oy = CreateCube()
PositionEntity Oy, 0,0,0
ScaleEntity Oy, 1,1000,1
EntityColor Oy, 255,255,255
Oz = CreateCube()
PositionEntity Oz, 0,0,0
ScaleEntity Oz, 1,1,1000
EntityColor Oz, 255,255,255
;Смещение для новых сфер по осям
Global dx,dy,dz
;Массив сфер 3х3х3
Dim Spheres(2,2,2)
While Not KeyDown(1)
For x=0 To 2
For y=0 To 2
For z=0 To 2
;Если сфера уже есть, то удаляем
If Spheres(x,y,z)>0 Then FreeEntity Spheres(x,y,z)
Spheres(x,y,z) = CreateSphere(20)
PositionEntity Spheres(x,y,z),x*2+dx, y*2+dy, z*2+dz
EntityColor Spheres(x,y,z), Rnd(255),Rnd(255),Rnd(255)
Next
Next
Next
;Измениние смещения сфер
dx=dx+1:dy=dy+1:dz=dz-1
UpdateWorld
RenderWorld
Flip
Wend