One possible working solution
rem Scorpyo 2007
rem Generic Template
rem Player = object 10
set display mode 1024,768,32
SYNC ON
SYNC RATE 60
backdrop on
color backdrop rgb(10,100,100)
autocam off
hide mouse
set global collision off
x#=1000.0:z#=1000.0:a#=0.0:s#=0.0:h#=0.0
cx#=0.0:cz#=0.0
radius#=200:hang#=0.0:vang#=120.0
gosub Setupland1
gosub makeobjects
gosub makeplayer
gosub resetcam
do
if x#<50 then x#=50
if x#>3950 then x#=3950
if z#<50 then z#=50
if z#>3950 then z#=3950
gosub printdata
gosub camera_control
gosub Playercontrol
if inkey$()="r" then gosub resetcam
SYNC
loop
rem -------------ROUTINES--------------------
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
get image 2,0,0,250,250
rem Make landscape
landsize=4000:grid=30:mtxrandomize=1
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
rem ***********
rem get ground done
update matrix 1
return
Playercontrol:
rem ---- Control Character ----
x#=newxvalue(x#,a#,s#)
z#=newzvalue(z#,a#,s#)
h#=get ground height(1,x#,z#)
position object 10,x#,h#+5,z#
yrotate object 10,a#
if inkey$()="w" and s#<3.0 then s#=s#+0.1
if inkey$()="s" and s#>-2.0 then s#=s#-0.1
if inkey$()="a" then a#=wrapvalue(a#-1)
if inkey$()="d" then a#=wrapvalue(a#+1)
if inkey$()="ù" then s#=0.0
return
rem -------CAMERA--------
camera_control:
if mouseclick()=2 then gosub resetcam
mymousez=mousemovez()
if mymousez>0 then radius#=radius#+20
if mymousez<0 then radius#=radius#-20
mymousex=mousemovex()
if mymousex>0 then hang#=wrapvalue(hang#-2.0)
if mymousex<0 then hang#=wrapvalue(hang#+2.0)
mymousey=mousemovey()
if mymousey>0 and vang#<178.0 then vang#=vang#+1.0
if mymousey<0 and vang#>92.0 then vang#=vang#-1.0
position camera x#+(sin(a#+hang#)*sin(vang#)*-radius#),h#+(cos(vang#)*-radius#),z#+(cos(a#+hang#)*sin(vang#)*-radius#)
rem Point camera at object
point camera x#,h#,z#
return
resetcam:
set camera range 1,20000
radius#=200
hang#=0.0
vang#=110.0
return
printdata:
set cursor 0,0
print " Polys=",statistic(1)
print " FPS=",screen fps()
print " x#= ",x#
print " z#= ",z#
print " player height#= ",h#
print " player angle#= ",a#
print " speed#= ",s#
print
print " w,a,s,d = move player"
print " ù= stop"
print " mouse move = orbit"
print " mousewheel = Zoom"
print " R mouse click= reset camera"
print
print " camera angles"
print " hang#= ",hang#
print " vang#= ",vang#
print " radius#= ",radius#
return
rem -------------Characters----------------
makeplayer:
make object cone 10,30
scale object 10,100,200,100
set object 10,1,1,0
xrotate object 10,90
fix object pivot 10
return
makeobjects:
randomize 2
for n=100 to 110
make object cube n,rnd(100)+100
next n
for n= 100 to 110
posx=rnd(3000)+500:posz=rnd(3000)+500
position object n,posx,50,posz
next n
return
end