here's a basic example:
________TOP_________:
rem Generic Matrix Template
set display mode 1024,768,32
SYNC ON
SYNC RATE 30
backdrop on
color backdrop rgb(10,100,100)
autocam off
set global collision off
x#=5000.0:z#=1000.0:a#=0.0:s#=0.0:h#=0.0
active=201
basex=2000:basez=1000
gosub Setupland1
gosub makevehicle
gosub setcam
________DO__LOOP________:
do
gosub update_camera
x#=newxvalue(x#,a#,s#)
z#=newzvalue(z#,a#,s#)
h#=get ground height(1,x#,z#)
gosub vehiclecontrol
SYNC
loop
_______ROUTINES_______:
Vehiclecontrol:
if upkey()=1 and s#<12.0 then s#=s#+0.5
if downkey()=1 and s#>-8.0 then s#=s#-0.5
if leftkey()=1 then a#=wrapvalue(a#-1.0)
if rightkey()=1 then a#=wrapvalue(a#+1.0)
if lefth#>righth# then position object active,x#,lefth#+sin(activeangz#)*70+25,z#
if lefth#<righth# then position object active,x#,righth#-sin(activeangz#)*70+25,z#
if lefth#=righth# then position object active,x#,righth#+25,z#
yrotate object active,a#
rem ------------align to ground---------------------
activefrontx#=newxvalue(x#,a#,frontoffset)
activefrontz#=newzvalue(z#,a#,frontoffset)
activebackx#=newxvalue(x#,a#,-rearoffset)
activebackz#=newzvalue(z#,a#,-rearoffset)
rem ------------------------------------------------
activerightx#=x#+cos(a#)*50
activerightz#=z#+sin(a#)*-50
activeleftx#=x#+cos(a#)*-50
activeleftz#=z#+sin(a#)*50
rem -----------------------------------------------
fronth#=get ground height(1,activefrontx#,activefrontz#)
backh#=get ground height(1,activebackx#,activebackz#)
righth#=get ground height(1,activerightx#,activerightz#)
lefth#=get ground height(1,activeleftx#,activeleftz#)
rem --------------------------------------------------
acrossheightdiff#=(righth#-lefth#)
activeangz#=atan(acrossheightdiff#/activewidth)
alonghdiff#=backh#-fronth#
activeangx#=atan(alonghdiff#/180)*0.9
xrotate object active,activeangx#
rotate limb active,0,0,0,activeangz#
return
makevehicle:
make object box 201,100,50,200
frontoffset=100:rearoffset=100:active=201:activewidth=100
return
______LAND________:
Setupland1:
rem ground textures
rem create texture
cls rgb(0,100,20)
inkcolor#=rgb(255,255,255)
line 0,0,0,250
line 1,1,1,250
line 2,2,2,250
line 0,0,250,0
line 1,1,250,1
line 2,2,250,2
line 0,0,250,250
line 0,250,250,0
get image 2,0,0,250,250
randomize 1
landsize=20000:grid=10:mtxrandomize=500
make matrix 1,landsize,landsize,grid,grid
set matrix 1,1,0,0,1,1,1,1
prepare matrix texture 1,2,1,1
randomize matrix 1,mtxrandomize
update matrix 1
return
rem -------CAMERA--------
rem camera update
update_camera:
cx#=newxvalue(x#,ca#,camdist)
cz#=newzvalue(z#,ca#,camdist)
cy#=get ground height(1,cx#,cz#)
position camera cx#,h#+camhgt,cz#
ca#=curveangle(a#,ca#,10)
yrotate camera ca#
return
setcam:
set camera range 10,10000
camfollow=1
camdist=-600
camhgt=200
camrot=0
return
end