Scratch that idea above. What I want the enemy to do is go along the maze and keep within the walls. This means checking static box collision, which kind of works the way I have it. Here is an example:
sync on
sync rate 40
make object plain 1,25,25
position object 1,0,0,-50
make object plain 2,50,50
position object 2,0,0,25
posx#=object position x(2)
posy#=object position y(2)
posz#=object position z(2)
make static collision box posx#,posy#,posz#,posx#,posy#,posz#
make object plain 3,50,50
position object 3,25,0,0
yrotate object 3,270
posx#=object position x(3)
posy#=object position y(3)
posz#=object position z(3)
make static collision box posx#,posy#,posz#,posx#,posy#,posz#
Do
posx#=object position x(1)
posy#=object position y(1)
posz#=object position z(1)
move object 1,1
if upkey()=1
move camera 2.5
endif
if downkey()=1
move camera -2.5
endif
cx#=wrapvalue(cx#+mousemovey())
cy#=wrapvalue(cy#+mousemovex())
cz#=wrapvalue(cz#+mousemovez())
rotate camera cx#,cy#,cz#
if static line of sight(posx#,posy#,posz#,posx#,posy#,posz#+25,5,1)=1
yrotate object 1,90
if static line of sight(posx#,posy#,posz#,posx#+25,posy#,posz#,5,1)=1
yrotate object 1,270
if static line of sight(posx#,posy#,posz#,posx#-25,posy#,posz#,5,1)=1
yrotate object 1,180
ENDIF
ENDIF
ENDIF
sync
Loop
The problem I have is that when the plain is traveling along the x axis rather than the z, the plain will go the opposite way it came. Could someone try and fix this or help me out. A suggestion for a better way is also welcome!
Bio Fox...four guys, one computer, games like nobody's business.