I think it has to do with the vertices ( or polygon ) density of your ground object.
If vertices are far apart the light tends to fade away when not close to them.
Lower the matrix grid value in the example to 10 or 20 and you'll see the effect.
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
set global collision off
x#=1000.0:z#=1000.0:a#=0.0:s#=0.0:h#=0.0
cx#=0.0:cy#=0.0:cz#=0.0:ca#=0.0:camh=50
camdist=0:lflag=0:lit=0
gosub Setupland1
gosub makeobjects
gosub makeplayer
gosub resetcam
gosub makelight
gosub ambience
do
if inkey$()="e" then sync rate 0
if inkey$()="E" then sync rate 60
gosub printdata
gosub update_camera
gosub Playercontrol
position light 1,x#,h#+50,z#
rotate light 1,0.0,a#,0.0
gosub handlelight
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
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=100:mtxrandomize=10
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
ambience:
set ambient light 20
hide light 0
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#+2,z#
yrotate object 10,a#
if upkey()=1 and s#<1.2 then s#=s#+0.02
if downkey()=1 and s#>-1.2 then s#=s#-0.02
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--------
rem camera update
update_camera:
mymousez=mousemovez()
if mymousez>0 then camdist=camdist+10
if mymousez<0 then camdist=camdist-10
rem Position camera to the back of the character
ca#=a#
cx#=newxvalue(x#,ca#,camdist)
cz#=newzvalue(z#,ca#,camdist)
cy#=h#
position camera cx#,cy#+30,cz#
rem Point camera at object
point camera x#,h#,z#
return
rem camera reset
Resetcam:
set camera range 1,20000
camdist=-80
return
printdata:
set cursor 0,0
print "Polys=",statistic(1)
print "FPS=",screen fps()
print "x#= ",x#
print "z#= ",z#
print "lflag= ",lflag
print "lit= ",lit
print
print "click mouse for light"
return
rem -------------Characters----------------
makewalker1:
make object sphere 10,20
return
makeplayer:
make object cone 10,10
scale object 10,100,200,100
set object 10,1,1,0
xrotate object 10,90
fix object pivot 10
return
makeobjects:
randomize 1
cubesize=50
for n=100 to 120
make object cube n,cubesize
xpos=rnd(landsize):zpos=rnd(landsize)
position object n,xpos,cubesize/2,zpos
next n
return
makelight:
make light 1
set light range 1,600
set point light 1,0.0,0.0,0.0
hide light 1
return
handlelight:
if mouseclick()=1 then lflag=0:show light 1:lit=1
if lit=1 then lflag=lflag+1
if lit=1 and lflag>10 then hide light 1:lit=0
return
end