This code should help you for the fly part:
some routines names are odd because it's old code revisited just never mind.
rem Scorpyo 2007
SYNC ON
SYNC RATE 60
backdrop on
color backdrop rgb(10,100,100)
autocam off
set global collision off
set text opaque
set ambient light 70
x#=0.0:z#=0.0:a#=0.0:s#=0.0:y#=0.0:flyflag=0
cx#=0.0:cy#=0.0:cz#=-300.0:ax#=0.0:ay#=0.0
camrot=0:newcamdist#=-300:zline=-100:camdist#=-300
gosub makewalker
gosub makeobjects
gosub setupmatrix
gosub startcam
do
if inkey$()="e" then sync rate 0
if inkey$()="E" then sync rate 60
if inkey$()="r" then gosub reset
gosub printdata
gosub Playercontrol
if yturn#<>0 then ay#=wrapvalue(ay#-yturn#/100)
gosub reset_rotation
gosub rotate_1
gosub rotate_2
gosub limbrotate
position camera x#+cx#,y#+cy#,z#+cz#
SYNC
loop
rem -------------ROUTINES--------------------
Playercontrol:
rem ---- Control Player ----
x#=object position x(10)
y#=object position y(10)
z#=object position z(10)
if upkey()=1
ax#=wrapvalue(ax#+0.5)
endif
if downkey()=1
ax#=wrapvalue(ax#-0.5)
endif
if leftkey()=1
yturn#=yturn#+0.2
ay#=wrapvalue(ay#-0.5)
az#=wrapvalue(az#+0.2)
endif
if rightkey()=1
yturn#=yturn#-0.2
ay#=wrapvalue(ay#+0.5)
az#=wrapvalue(az#-0.2)
endif
if inkey$()="f" then flyflag=1
if inkey$()="F" then flyflag=0
if flyflag=1 then move object 10,1
return
rem player / camera handling routines
reset_rotation:
yrotate object 10,0.0
xrotate object 10,0.0
yrotate camera 0.0
xrotate camera 0.0
camdist#=-300
newcamdist#=-300
ay1#=0.0
ax1#=0.0
cx#=sin(ay1#)*camdist#
cz#=cos(ay1#)*camdist#
position camera x#+cx#,y#+cy#,z#+cz#
return
rotate_1:
xrotate object 10,ax#
cy#=sin(ax#)*-camdist#
cz#=cos(ax#)*camdist#
newcamdist#=cos(ax#)*-300
xrotate camera ax#
return
rotate_2:
yrotate object 10,ay#
camdist#=newcamdist#
cx#=sin(ay#)*camdist#
cz#=cos(ay#)*camdist#
yrotate camera ay#
return
limbrotate:
rotate limb 10,0,0.0,0.0,az#
return
rem camera
startcam:
set camera range 1,20000
position camera cx#,cy#,cz#
return
reset:
x#=0.0:y#=0.0:z#=0.0
ax#=.0:ay#=0.0
position object 10,x#,y#,z#
xrotate object 10,ax#
yrotate object 10,ay#
camdist#=-300
newcamdist#=-300
cx#=sin(ay#)*camdist#
cz#=cos(ay#)*camdist#
cy#=0.0
position camera x#+cx#,y#+cy#,z#+cz#
yrotate camera ay#
xrotate camera ax#
return
printdata:
set cursor 0,0
print "polys ",statistic(1)
print "frame rate=",screen fps()
print "x#= ",x#
print "y#= ",y#
print "z#= ",z#
print
print "cx#= ",cx#
print "cy#= ",cy#
print "cz#= ",cz#
print
print "ay#= ",ay#
print "ax#= ",ax#
print
print "f = start flying"
print "F = stop flying"
print "r = reset start position"
return
rem -------------Characters----------------
makewalker:
make object cube 10,50
set object 10,1,1,0,1,1,1
scale object 10,100,100,200
position object 10,x#,y#,z#
color object 10,rgb(10,10,140)
return
makeobjects:
for n=101 to 120
make object cube n,20
next n
for n=101 to 109
position object n,-160,-30,zline
zline=zline+100
next n
zline=-100
for n=110 to 118
position object n,160,-30,zline
zline=zline+100
next n
position object 119,60,-30,zline
position object 120,-60,-30,zline
randomize 1
for n=200 to 210
px=rnd(5000)-2000:py=rnd(5000)+1000:pz=rnd(5000)+1000
make object sphere n,200
position object n,px,py,pz
next n
return
rem matrix
setupmatrix:
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
rem next n
get image 2,0,0,250,250
rem Make landscape
landsize=4000:grid=30:mtxrandomize=30
make matrix 1,landsize,landsize,grid,grid
set matrix 1,1,0,0,1,1,1,1
position matrix 1,-2000,-1000,-1000
prepare matrix texture 1,2,1,1
randomize matrix 1,mtxrandomize
rem ***********
rem get ground done
update matrix 1
return
end