This is my code (partly in Dutch - excuse me for that)
dispX=800:dispY=600:colordepth=16
set display mode dispX,dispY,colordepth
hide mouse: autocam off
set camera range 1,750
set global collision on
set mipmap mode 1
enable static occlusion
set normalization on
mousesens#=1.5
posx#=250
posy#=2.5
posz#=250
stapvooruit# = 7
camerahoekx = 0
camerahoeky = 0
camhoogte# = 20
scorphoogte = 0
muurhoogte=40
load image "floor.bmp",1
load image "muur.bmp",2
load image "crosshair.bmp",3
load sound "fire.wav",1
load object "c:\test\walk.X",50
rem wandelaar
position object 50,20,scorphoogte,25
yrotate object 50,270
loop object 50,1,24
scale object 50,14,14,14
rem Grond matrix maken
make matrix 1,500,500,30,30
prepare matrix texture 1,1,1,1
rem backdrop en fog
color backdrop rgb(0,0,0):backdrop on
fog distance 400:fog on
rem cylinder maken
make object cylinder 100,10
position object 100,250,2.5,250
s#=object size x(100)/2
make object collision box 100, 245, 0, 245, 255, 10, 255, 0
set object collision to boxes 100
hide object 100
rem kogelstrook maken
make object plain 99,sqrt(250000),0.1
position object 99,250,50,230
xrotate object 99,90
rem muren maken
rem muren maken >>> buitenrand
for i = 1 to 4:make object plain i,505,muurhoogte:next i
yrotate object 1,0
position object 1,250,muurhoogte/2,500
make static object 1
make static collision box 0,0,500,500,muurhoogte,500
yrotate object 2,90
position object 2,500,muurhoogte/2,250
make static object 2
make static collision box 500,0,0,500,muurhoogte,500
yrotate object 3,180
position object 3,250,muurhoogte/2,0
make static object 3
make static collision box 0,0,0,500,muurhoogte,0
yrotate object 4,270
position object 4,0,muurhoogte/2,250
make static object 4
make static collision box 0,0,0,0,muurhoogte,500
rem muren maken >>> binnenmuren
make object plain 5,401,muurhoogte
position object 5,250,muurhoogte/2,450
make static object 5
make static collision box 50,0,448,450,muurhoogte,452
make object plain 6,401,muurhoogte
yrotate object 6,90
position object 6,50,muurhoogte/2,250
make static object 6
make static collision box 48,0,50,52,muurhoogte,450
make object plain 7,401,muurhoogte
yrotate object 7,90
position object 7,450,muurhoogte/2,250
make static object 7
make static collision box 448,0,50,452,muurhoogte,450
draw to front
sprite 1,dispX/2,dispY/2,3
rem Loop
autocam on
do
oldposx#=object position x(100)
oldposy#=object position y(100)
oldposz#=object position z(100)
if upkey() = 1 then move object 100,stapvooruit#/2: stepagain=1
if downkey() = 1 then move object 100,stapvooruit#*(-1)
if mousemovex() > 0 then inc camerahoekx,mousemovex()*mousesens#:if camerahoekx > 360 then dec camerahoekx,360
if mousemovex() < 0 then inc camerahoekx,mousemovex()*mousesens#:if camerahoekx < 0 then inc camerahoekx,360
rem if mousemovey() > 0 then inc camerahoeky,mousemovey():if camerahoeky > 360 then dec camerahoeky,360
rem if mousemovey() < 0 then inc camerahoeky,mousemovey():if camerahoeky < 0 then inc camerahoeky,360
yrotate object 100,camerahoekx
if mouseclick()=1
play sound 1
position object 99,posx#,posy#+camhoogte#*0.75,posz#
yrotate object 99, camerahoekx+90
move object 99,sqrt(250000)/2
endif
posx#=object position x(100)
posy#=object position y(100)
posz#=object position z(100)
rem Handle sliding collision for player object with other objects
if object collision(100,0)>0
dec posx#,get object collision x()
dec posz#,get object collision z()
endif
rem Ensure camera stays out of static collision boxes
if get static collision hit(oldposx#-s#,oldposy#-s#,oldposz#-s#,oldposx#+s#,oldposy#+s#,oldposz#+s#,posx#-s#,posy#-s#,posz#-s#,posx#+s#,posy#+s#,posz#+s#)=1
dec posx#,get static collision x()
dec posz#,get static collision z()
endif
position object 100,posx#,posy#,posz#
rem tweede stap
if stepagain=1 then move object 100,stapvooruit#/2: stepagain=0
set camera to follow posx#,posy#,posz#,camerahoekx,1,camhoogte#,1,1
rem wandelaar bewegen
move object 50,-1
walkx=object position x(50)
if walkx<10 or walkx>490 then yrotate object 50,90
sync
loop