what is wrong with this code the program should end when the object hits the tunnel's side
set display mode 1024,768,32
Remstart
By:The Newbie
Remend
gosub tunnel
gosub prepare
gosub collision
gosub loops
`do
` if upkey()=1 then move camera 500
` if downkey()=1 then move camera -500
` if rightkey()=1 then turn camera right 5
` if leftkey()=1 then turn camera left 5
`loop
end
Tunnel:
load image "texture.bmp",1
Make object cylinder 1,500
`load object "tunnel 2.x",1
texture object 1,1
scale object 1,50,50,50000
xrotate object 1,90
set camera range 1,50000000
fix object pivot 1
d=object size z(1)/2
position camera object position x(1),object position y(1),-125000
set object 1,1,1,0
scale object texture 1,.05,5
return
prepare:
`autocam off
load object "SPCVEH08.X",2
position object 2,camera position x(),camera position y()-10,camera position z()+50
yrotate object 2,90
fix object pivot 2
lock object on 2
autocam off
`make object cylinder 3,505
`scale object 3,50,50,50000
`xrotate object 3,90
`fix object pivot 3
return
collision:
set object collision on 1
set object collision on 2
set global collision on
`set object collision to polygons 3
set object collision to polygons 1
set object collision to polygons 2
return
loops:
do
if upkey()=1 then move camera 200
if downkey()=1 then move camera -200
if rightkey()=1 then turn camera right 5
if leftkey()=1 then turn camera left 5
if object hit(2,0)>0 then end
loop