This one is from a different program (made with DBC v1.13 too).
Function FREEFLIGHT()
Do
` Wraps the screen around horizontally
If mousex()=639 Then Position Mouse 1,Mousey()
If mousex()=0 Then Position Mouse 638,Mousey()
` Rotates left/right
ANGLE_H#=Mousex()*360.0/640.0
` Rotates up/down
ANGLE_V#=(Mousey()*180.0/480.0)-90
` Ensure angle stays within range
ANGLE_V#=wrapvalue(ANGLE_V#)
` Update camera
Yrotate Camera ANGLE_H#
Xrotate Camera ANGLE_V#
VEL=Scancode()
If VEL>1 And VEL<12
Play Sound 1
Set Sound Volume 2,(VEL-1)*10
SPEED#=VEL-1 : Rem This for planet surfaces
Endif
If VEL=57
Play Sound 1
Set Sound Volume 2,0
SPEED#=0
Endif
ALTITUDE#=Camera Position Y()
If ALTITUDE#>0
Move Camera SPEED#
Else
ANGLE_V=0
Endif
SYNC
` End loop
Loop
Endfunction
It is a simple free flight routine, where you can control the direction with the mouse, select your speed with the number keys and stop with the space bar. My intention at the end was to insert a control to avoid going below ground level; the problem is that, when you reach ground level, you can't move anymore, no matter what you do. Instead, what I have in mind to do is to stop when you reach ground level and to start moving again if VEL is >0
AND you look up (that is, any direction above horizontal). How do I fix it?