Posted: 27th Mar 2003 1:07
I was bored and looking to make a snippet that didn't require any media and looked kinda cool. It's very simple code.

This will only work good with patch 4 or DBC cause it makes up to 625 boxes.

+ Code Snippet
autocam off
sync on
sync rate 60
hide mouse

`lighting
color backdrop 0
set ambient light 0
make light 1
make light 2
color light 0,RGB(0,0,128)
color light 1,RGB(0,128,0)
color light 2,RGB(128,0,0)

`user input
again:
while returnkey()=0
cls
set cursor 0,0
print "Input the number of rows & columns"
print "5 minimum / 25 Maximum"
cb$=entry$()
if scancode()=14 then clear entry buffer
print cb$
sync
endwhile
clear entry buffer
cbnum=val(cb$)
if cbnum25 then goto again
cls
center text 320,240,"LOADING"
sync

`calc cube position offset
cbnum#=cbnum
if (cbnum#/2.0)-(cbnum/2)>0
   sub#=((cbnum+1)/2)*5
else
   sub#=((cbnum#/2.0)*5.0)+2.5
endif

`make cubes
for y=1 to cbnum
for x=1 to cbnum
   obj=obj+1
   make object cube obj,10
   position object obj,(x*5)-sub#,(y*5)-sub#,0
   ghost object on obj
next x
next y

`offset light positions
l2=45
l3=135

`camera setup
position camera 0,0,-1*(cbnum*3)
point camera 0,0,0

do
set cursor 0,0
if spacekey()=1 then print screen fps()

`new value for light potitions
l1=wrapvalue(l1+1)
l2=wrapvalue(l2+1)
l3=wrapvalue(l3+1)

`Find camera x/y/z
l1x#=sin(l1)*65
l1y#=cos(l1)*65
l2x#=sin(l2)*65
l2z#=cos(l2)*65
l3y#=sin(l3)*65
l3z#=cos(l3)*65

`rotate cubes
for objr=1 to cbnum*cbnum
xrotate object objr,wrapvalue(object angle x(objr)+0.2)
yrotate object objr,wrapvalue(object angle y(objr)+0.2)
zrotate object objr,wrapvalue(object angle z(objr)+0.2)
next objr

`position lights
position light 0,l1x#,l1y#,0
position light 1,l2x#,0,l2z#
position light 2,0,l3y#,l3z#

sync
loop