I know that We`v already talked hundreds of times about the matrix . Just being obstinate with collision and reading other friends problems, I,v made a piece of code that can nearly do collision with the matrix walls.
Instead of going straight ahead, we are forced to walk around the hills.
I hope that this piece of code can help somehow.
cheers.
autocam off
sync on
ink rgb(0,100,0),1:box 0,0,50,50
ink rgb(0,200,0),1:box 10,10,40,40
ink rgb(0,130,0),0:set cursor 0,0
print
print "CHAFARI"
print "CHAFARI"
print "CHAFARI"
get image 1,0,0,50,50,1
`We make the terrain
`_______________________
make matrix 1,2000,2000,50,50
prepare matrix texture 1,1,1,1
randomize matrix 1,50
for i= 10 to 40
set matrix height 1,i+rnd(5),i+rnd(5),rnd(300)
next i
update matrix 1
`starting position
x#=300
z#=300
`________________________
do
oldx#=x#
oldz#=z#
//camera controls
if upkey()=1 then x#=newxvalue(x#,a#,0.3) : z#=newzvalue(z#,a#,0.3)
if downkey()=1 then x#=newxvalue(x#,a#,-0.3) : z#=newzvalue(z#,a#,-0.3)
if leftkey()=1 THEN x#=NEWXVALUE(x#,a#-90,0.3):z#=NEWZVALUE(z#,a#-90,0.3)
if rightkey()=1 THEN x#=NEWXVALUE(x#,a#-90,-0.3):z#=NEWZVALUE(z#,a#-90,-0.3)
a#=wrapvalue(a#+mousemovex()/2)
cam#=wrapvalue(cam#+mousemovey()/2)
y#=get ground height(1,x#,z#)
`camera limits
if cam#<=290 and cam#>180 then cam#=290
if cam#>=70 and cam#<180 then cam#=70
rotate camera cam#,a#,0
`we make sure the player walk around
`_____________________________________
xd#=get ground height(1,x#+30,z#)
xi#=get ground height(1,x#-30,z#)
zf#=get ground height(1,x#,z#+30)
zb#=get ground height(1,x#,z#-30)
if xd#>y#+20 then x#=oldx#:dec x#,0.3
if xi#>y#+20 then x#=oldx#:inc x#,0.3
if zf#>y#+20 then z#=oldz#:dec z#,0.3
if zb#>y#+20 then z#=oldz#:inc z#,0.3
position camera x#,y#+5,z#
`_____________________________________
sync
loop
oh my god