This is a simple 3D program I'm using to learn how to use cameras, level creation, 3D collision, and lighting. I've been modifying a 3D platformer snippet, so I left the original author's info.
Use the arrow keys to move the block around, hold space to raise and lower it. Lower the block on top of the sphere to pick it up, and press enter to release it.
rem Project: Realms Of Tutopia I
rem Created: 24/01/2005 16:45:11
rem Author: Andrew Neale
rem Setup display
set display mode 800,600,32
set window on
autocam off
hide mouse
rem Create a player object
make object sphere 1,25
make object collision box 1,-12.5,-12.5,-12.5,12.5,12.5,12.5,0
color object 1,rgb(200,0,200)
rem Create backdrop item
make object box 1000,(23*50),(12*50),1
position object 1000,object size x(1000)/2+25,object size y(1000)/2+25,25
color object 1000,rgb(128,128,0)
make object collision box 1000,-575,-300,-.5,575,300,.5,0
rem make Crane object
make object box 1001,25,25,10
position object 1001,object size x(1000)/2+25,object size y(1000)/2+25,-200
make object collision box 1001,-12.5,-12.5,-5,12.5,12.5,5,0
color object 1001,rgb(60,60,120)
rem light
color light 0,128,128,196
set ambient light 30
color ambient light rgb(30,30,90)
set directional light 0,0,0,1
position light 0,575,300,-1000
set shadow shading on 1
SET SHADOW SHADING ON 1001
rem Create a level
LevelObject=2
for y=12 to 1 step -1
for x=1 to 23
read TestLevel1Data
if TestLevel1Data=1
make object box LevelObject,50,50,50
position object LevelObject,x*50,y*50,0
make object collision box LevelObject,-25,-25,-25,25,25,25,0
color object LevelObject,rgb(40,180,120)
inc LevelObject
endif
if TestLevel1Data=9
position object 1,x*50,y*50,0
xa#=x*50
ya#=y*50
za#=0
endif
next x
next y
rem Variables
x#=575
y#=300
z#=-200
rem Manual synchronisation
sync on
sync rate 0
rem Main loop
do
set cursor 0,0
print "FPS: "+str$(screen fps())
print "block height: "+str$(z#)
print "toggle: "+str$(toggle)
rem Control character
if upkey()=1
y#=y#+1
endif
if downkey()=1
y#=y#-1
endif
if rightkey()=1
x#=x#+1
endif
if leftkey()=1
x#=x#-1
endif
position object 1001,x#,y#,z#
position object 1,xa#,ya#,za#
if spacekey()=1 and object collision(1001,1)=0 and toggle=0
z#=z#+1
endif
if z#=0 or object collision(1001,1)>0 then toggle=1
if spacekey()=1 and z#>-200 and toggle=1
z#=z#-1
endif
if z#=-200 then toggle=0
if object collision(1001,1)>0
xa#=x#
ya#=y#
za#=z#+12
endif
if returnkey()=1 and object collision(1001,1)>0
za#=za#+25
endif
if object collision(1,0)=0
za#=za#+1
endif
position object 1001,x#,y#,z#
position object 1,xa#,ya#,za#
rem Control camera
camX#=(object size x(1000)/2+25)/2+x#/2
camY#=(object size y(1000)/2+25)/2+y#/2
camZ#=z#-200
position camera camX#,camY#,camZ#
point camera x#,y#,z#
rem Update screen
sync
rem End main loop
loop
TestLevel1Data:
data 1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1
data 1,0,0,0,0,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,1
data 1,0,1,1,1,1,1,1,1,0,0,0,0,1,1,0,0,0,1,1,0,0,1
data 1,0,0,0,0,0,0,0,1,0,0,0,0,0,0,0,0,0,0,0,0,0,1
data 1,0,0,0,0,0,1,0,1,0,0,9,0,0,0,0,0,0,0,0,0,1,1
data 1,1,1,0,0,0,1,0,1,0,0,0,1,1,0,1,0,0,0,0,0,0,1
data 1,0,0,1,0,0,1,0,1,0,1,0,0,1,0,1,1,1,1,1,1,1,1
data 1,0,0,0,1,1,1,0,1,0,0,0,0,0,0,0,0,0,0,0,0,0,1
data 1,0,1,1,0,0,0,0,1,1,0,0,1,1,1,0,0,0,0,0,0,0,1
data 1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,1,1
data 1,1,0,0,0,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,1,1,1
data 1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1
What's the deal with the additional shadows being cast? And I apologize for the colors, I'm colorblind.
Also, where are the help files for shadows? I couldn't find them.