OK. I'm have gotten the coding correct for the mouse to control the camera angle, but I cannot move forward or strife (which is the latest addition in this tutorial). I believe the problem is that I am starting outside of the matrix, where I have checks to make sure that I do not move off of it. Here is the code:
sync on
sync rate 30
backdrop on
set camera range 1,5000
fog on
fog distance 4000
fog color rgb(128,128,128)
color backdrop rgb(128,128,128)
make matrix 1,10000,10000,20,20
load image "rustyIron.bmp",1
prepare matrix texture 1,1,1,1
fill matrix 1,0,1
randomize matrix 1,125
rem this is where I tried to reposition my self in the middle of the matrix
position camera 200,0,200
do
oldcamangleY# = camangleY#
oldcamangleX# = camangleX#
camangleY# = wrapvalue(camangleY#+mousemoveX()*0.2)
camangleX# = wrapvalue(camangleX#+mousemoveY()*0.2)
rem I do not exactly understand this part about the movements
if upkey()=1
xtest#=newxvalue(x#,aY#,20)
ztest#=newzvalue(z#,aY#,20)
if xtest#>0 and xtest<10000 and ztest#>0 and ztest#<10000
X#=xtest#
Z#=ztest#
endif
endif
if downkey()=1
xtest#=newxvalue(X#,wrapvalue(camangleY#-180),10)
ztest#=newzvalue(Z#,wrapvalue(camangleY#-180),10)
if xtest#>0 and xtest<10000 and ztest#>0 and ztest#<10000
X# = xtest#
Z# = ztest#
endif
endif
rem Here is where I added the strifing
if leftkey()=1
xtest#=newxvalue(X#,WrapValue(camangleY#-90),10)
ztest#=newzvalue(Z#,wrapvalue(camangleY#-90),10)
if xtest#>0 and xtest#<10000 and ztest#>0 and ztest#<10000
X# = xtest#
Z# = ztest#
endif
endif
rem more strifing here
if rightkey()=1
xtest#=newxvalue(X#,wrapvalue(camangleY#+90),10)
ztest#=newzvalue(Z#,wrapvalue(camangleY#+90),10)
if xtest#>0 and xtest#<10000 and ztest#>0 and ztest#<10000
X# = xtest#
Z# = ztest#
endif
endif
Yrotate camera curveangle(camangleY#,oldcamangleY#,24)
Xrotate camera curveAngle(camangleX#,oldcamangleX#,24)
y# = get ground height(1,X#,Z#)
position camera X#,Y#+50,Z#
sync
loop
I am sorry to keep asking ?s, but I am trying to finish these tutorials, then I will begin with my own simple game. Thank you all for being patient with me!
Fraggles where quite the scary lot...