sync on
make matrix 1, 1000,1000,20,20
randomize matrix 1,50.0
do
x#=camera position x()
z#=camera position z()
a#=camera angle y()
`Search for pressed keys
if leftkey()=1
`according to current a#, get the new angle for camera
`this makes a# decrease one value.
a#=a#-1
if a#<0 then a#=a#+360
endif
if rightkey()=1
a#=a#+1
if a#>=360 then a#=a#-360
endif
if upkey()=1
`get the new values for x# and z# knowing that x#=current camera
`position x and z#=current camera position z
`and knowing that a# is trhe angle of the camera
x#=newxvalue(x#,a#,1)
z#=newzvalue(z#,a#,1)
endif
if downkey()=1
`get the new values for x# and z# knowing that x#=current camera
`position x and z#=current camera position z
`and knowing that a# is trhe angle of the camera
x#=newxvalue(x#,a#,-1)
z#=newzvalue(z#,a#,-1)
endif
`getting the height of the ground in the position the camera is
y#=get ground height(1,x#,z#)
`increase y# a little
inc y#,10.0
`seting the new position and rotation for camera
position camera x#,y#,z#
yrotate camera a#
sync
loop
here is a example of how to do it!
Have fun programing!!!