something like this
rem Scorpyo 2007
rem Generic Grass Template
rem Player = object 10
SYNC ON
SYNC RATE 60
set display mode 1024,768,32
backdrop on
color backdrop rgb(10,100,100)
autocam off
set global collision off
x#=4000.0:z#=4000.0:a#=10.0:s#=0.0:h#=0.0
cx#=0.0:cy#=0.0:cz#=0.0:ca#=0.0:camght=0
camrot=0:camdist=0:camlen=0:grassy#=0.0:sector$=""
grassx#=0.0:grassz#=0.0:grassx1#=0.0:grassz1#=0.0
gosub makematrix
gosub makeplayer
gosub makeobjects
gosub makegrass
gosub positiongrass
gosub resetcam
do
if inkey$()="e" then sync rate 0
if inkey$()="E" then sync rate 60
if inkey$()="r" then gosub reset
gosub camera_controls
gosub update_camera
gosub Playercontrol
rem gosub rollgrass
gosub printdata
SYNC
loop
rem -------------ROUTINES--------------------
makematrix:
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
rem Make landscape
landsize=8000:grid=30:mtxrandomize=100
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 get matrix 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#,z#
yrotate object 10,a#
if upkey()=1 and s#<3.0 then s#=s#+0.1
if downkey()=1 and s#>-3.0 then s#=s#-0.1
if leftkey()=1 then a#=wrapvalue(a#-1)
if rightkey()=1 then a#=wrapvalue(a#+1)
if inkey$()="ù" then s#=0.0
if inkey$()="à" then s#=10.0
return
rem -------CAMERA--------
camera_controls:
position mouse 800,600
if inkey$()=">" then gosub Resetcam
if inkey$()="m" then camdist=-1000:camhgt=500:camrot=0:set camera range 100,20000
if inkey$()="M" then camdist=-3000:camhgt=1000:camrot=0:set camera range 100,20000
mymousex=mousemovex()
if mymousex>0 then camrot=camrot+2
if mymousex<0 then camrot=camrot-2
mymousey=mousemovey()
if mymousey>0 then camlen=camlen+3
if mymousey<0 then camlen=camlen-3
mymousez=mousemovez()
if mymousez>0 then camdist=camdist+10
if mymousez<0 then camdist=camdist-10
return
rem camera update
update_camera:
rem Position camera to the back of the character
ca#=wrapvalue(a#+camrot)
cx#=newxvalue(x#,ca#,camdist)
cz#=newzvalue(z#,ca#,camdist)
cy#=h#
position camera cx#,cy#+camhgt,cz#
rem Point camera at object
point camera x#,h#+camhgt+camlen,z#
return
rem camera reset
Resetcam:
set camera range 10,10000
camdist=-700
camhgt=300
camrot=0
camlen=-100
return
printdata:
set cursor 0,0
print "Polys=",statistic(1)
print "FPS=",screen fps()
print "x#= ",x#
print "ground height= ",h#
print "z#= ",z#
print
print "speed=",s#
print
print "player angle =",a#
print
print sector$
return
printdata2:
set cursor 0,0
print statistic(1)
print screen fps()
print "x#= ",x#
print "h#= ",h#
print "z#= ",z#
print "a#= ",a#
print "s#= ",s#
return
makeplayer:
make object cone 10,60
set object 10,1,1,0
scale object 10,100,200,100
xrotate object 10,90
fix object pivot 10
return
makeobjects:
randomize 1
cubesize=100
for n=100 to 110
make object cube n,cubesize
xpos=rnd(landsize):zpos=rnd(landsize)
ypos=get ground height(1,xpos,zpos)
position object n,xpos,ypos+cubesize/2-30,zpos
color object n,1000
next n
return
makegrass:
cls rgb(100,30,30)
get image 3,0,0,128,128
for n=1000 to 3000
make object plain n,5,20
set object n,1,1,0
texture object n,3
next n
return
positiongrass:
randomize 400
for n=1000 to 3000
gy#=rnd(360)
grassx#=rnd(8000):grassz#=rnd(8000)
grassy#=get ground height(1,grassx#,grassz#)
position object n,grassx#,grassy#+10,grassz#
yrotate object n,gy#
next n
return
reset:
x#=4000.0:z#=4000.0:a#=0.0:s#=0.0
position object 10,x#,h#,z#
gosub positiongrass
return
end