Thank you, I'll try those, but let me post my code so far ...
set display mode 800,600,16
hide mouse
sync on
sync rate =30
autocam off
print "Loading picture..."
sync
load image "TreeBark1.jpg",1
load image "GrassTex.jpg",2
print "Loading music..."
sync
load music "Helm.mp3",1
playerx#=0
playery#=5
playerz#=-10
print "Loading object..."
sync
load object "trunk.x",1
hide object 1
make mesh from object 1,1
make object sphere 10,3
Remstart -------------------------AI CODE SETUP!-----------------------------
make object sphere 9, 3
position object 9, 100, 7, 100
AIX#=object position x(9)
AIY#=object position y(9)
AIZ#=object position z(9)
Remend
make matrix 1, 300, 300, 10, 10
randomize matrix 1, 5
prepare matrix texture 1,2,1,1
set object collision to spheres 10
for trees=11 to 500
make object trees,1,1
position object trees, rnd(200), 1, rnd(200)
treeY#=get ground height (1, object position x(trees), object position z(trees))
position object trees, object position x(trees), treeY#, object position z(trees)
scale object trees, 100, rnd(150),100
sx#=object size x(trees)/2
sy#=object size y(trees)/2
sz#=object size z(trees)/2
set object collision on trees
make object collision box trees,-1*sx#,-1*sy#,-1*sz#,sx#,sy#,sz#,0
next trees
fog on
fog distance 250
fog color RGB(200,200,200)
backdrop on
color backdrop RGB(200,200,200)
set camera range 1,235
set ambient light 100
`loop through matrix tiles
for xTile=0 to 9
for zTile=0 to 9
`set the matrix tile texture
set matrix tile 1,xTile,zTile,1
next zTile
next xTile
update matrix 1
position object 10, playerx#,playery#,playerz#
texture object 1,1
xPos#=10
yPos#=5
zPos#=10
xAng#=0
yAng#=0
zAng#=0
playerXang#=0
playerYang#=0
playerZang#=0
Rem Camera Mode - First Person
CameraMode=0
hold = 0
loop music 1
yVel#=0
g#=2
y#=0
Rem ****************Camera Loop************
do
if CameraMode=0 then CameraMode=CameraFirst(CameraMode) else CameraMode=CameraThird(CameraMode)
sync
if Activated(1,1)=1 then text 0,0, "Tree selected"
Remstart --------------------------AI CODE!------------------------------
if object position x(9)<object position x(10)
inc AIX#,.1
else
dec AIX#,.1
endif
if object position y(9)<object position y(10)
inc AIY#,.1
else
dec AIY#,.1
endif
if object position z(9)<object position z(10)
inc AIZ#,.1
else
dec AIZ#,.1
endif
position object 9, AIX#, AIY#, AIZ#
Remend
loop
function CameraFirst(CameraMode)
PlayerXAng# = Object Angle X (10)
PlayerYAng# = Object Angle Y (10)
PlayerZAng# = Object Angle Z (10)
CameraXAng# = Camera Angle x()
if upkey()=1 then Move Object 10,.5
if downkey()=1 then Move Object 10,-.5
if rightkey()=1 then Move Object Right 10, .5
if leftkey()=1 then Move Object Left 10, .5
if mouseclick()=1 and y#<=get ground height(1,X#,Z#)+5
yvel#=20
endif
REM if you click the mouse and the object is on the ground,
REM make it jump
yvel#=yvel#-g#
REM make gravity affect the motion
if y#<=get ground height(1,X#,Y#)+5 and yvel#<=0
y#=get ground height(1,X#,Y#)+5
REM if the ball goes beneath the terrain, put it on top
if yvel#+g#+6>=get ground height(1, X#, Z#)+5
REM if the ball has only been affected by gravity and
REM the velocity is small enough, stop it bouncing (so
REM it doesn't bounce forever)
yvel#=0
else
REM else bounce it upwards with a decreased velocity
yvel#=-0.4*yvel#
endif
endif
y#=y#+yvel#
REM move the object by the velocity
if scancode()=15 and hold=0
CameraMode=1
hold=1
endif
if keystate(15)=0
hold = 0
else
hold = 1
endif
X# = Object position X(10)
Z# = Object position Z(10)
if object collision(10,0)
dec x#,get object collision x()
dec y#,get object collision y()
dec z#,get object collision z()
endif
Position object 10,X#,Y#,Z#
Position Camera X#,Y#,Z#
if cameraXang#<359.0 and cameraXang#>200.0
if cameraXang#<290.0 then cameraXang#=290
endif
if cameraXang#>0.0 and cameraXang#<100.0
if cameraXang#>70.0 then cameraXang#=70.0
endif
`Xrotate object 10, Wrapvalue(playerXang#+MouseMoveY()*.2)
Xrotate camera WrapValue(CameraXAng#+MouseMoveY()*.2)
Yrotate object 10, Wrapvalue(playerYang#+MouseMoveX()*.2)
Yrotate camera WrapValue(playerYang#+MouseMoveX()*.2)
endfunction CameraMode
function CameraThird(CameraMode)
playerthirdY# = Object angle Y(10)
If Upkey()=1 then Move object 10,.5
If Downkey()=1 then Move object 10,-.5
If LeftKey() = 1 then Move object left 10, .3
If RightKey() = 1 then Move object right 10, .3
Yrotate object 10, Wrapvalue(playerthirdY#+MouseMoveX()*.2)
if scancode()=15 and hold=0
CameraMode=0
hold=1
endif
if keystate(15)=0
hold = 0
else
hold = 1
endif
SphereX# = Object position x(10)
SphereZ# = Object position z(10)
cZ# = Newzvalue(SphereZ#,playerthirdY#+180,20)
cX# = Newxvalue(SphereX#,playerthirdY#+180,20)
X# = Object position X(10)
Z# = Object position Z(10)
Y# = Get ground height(1,X#,Z#)
if object collision(10,0)
dec x#,get object collision x()
dec y#,get object collision y()
dec z#,get object collision z()
endif
Position object 10,X#,Y#+5,Z#
Position Camera cX#,Y#+10,cZ#
Point camera SphereX#,Y#+7,SphereZ#
endfunction CameraMode
Sorry if it's confusing, I don't do nearly as much commenting as i should. I was only trying to add the gravity to one camera, then duplicate success with the other ... but it's not working well at all. Thanks guys.
P.S. This is what the alphabet would look like if Q and R were eliminated.