Well ill post the rest of my code, nesting them didnt work. Ignore the fact the object is a gun, its just an object im using to test collision. Also is there a reason that my while loops didnt work? Ive Remmed them out for now but I hope you can tell me what is wrong.
rem world creation
sync on
hide mouse
Randomize timer()
Set global collision on
set text to bold : Set text font "arial" : Set text size 16
REMSTART
Pretty much a joke loading screen :P
Although it does need a few seconds to load without it
REMEND
sync : center text screen width()/2,screen height()/2,"LOADING" : sync
gosub _Load_Game_Media
gosub _Setup_Game
DO
gosub _Player_Control
gosub _Hoop_Collision
sync
LOOP
_Setup_Game:
' Matrix----------------------
make matrix 1,500,3000,100,100
randomize matrix 1,3
prepare matrix texture 1,1,60,60
REM SKY
make object sphere 10,1000
scale object 10,500,500,500
set object 10,1,0,0,1,1,1,1
texture object 10,2
' -------------------------------------
' -----------------Setup the ship------------
scale object 1,2,2,2
position object 1,50,50,15
' ---------------------
' ----------------Setup the hoops------------(cubes atm)
make object cube 2,50
position object 2,40,50,20
REMSTART Cube_No generates an object number so the command "make object" can be run multiple
times with one line of code (or three) (Did it like this for the sake of practice)
FOR Cube_No=2 to 5
make object cube Cube_No,10
Next Cube_No
FOR Obj_Pos=2 to 5
position object Obj_Pos,RND(400),RND(200),RND(2500)+50
Next Obj_Pos
REMEND
' -------------------------------------------
update matrix 1
make camera 1
return
_Player_Control:
position camera 1,object position x(1),object position y(1),object position z(1)-40
position object 10,object position x(1),object position y(1), object position z(1)
if upkey() then xrotate object (1), object angle x(1)-0.4
if downkey() then xrotate object (1), object angle x(1)+0.4
if object position y(1)<=10
position object 1,object position x(1),10,object position z(1)
endif
REM Forward and backwards movement of the ship
if keystate(30) then move object 1,-0.5
If keystate(44) then move object 1,0.5
if leftkey()
dec x
yrotate object 1,wrapvalue(x)
endif
if rightkey()
inc x
yrotate object 1,wrapvalue(x)
endif
return
_Hoop_Collision:
If object collision(1,2)
if Hoop2Passed=0
set cursor 0,15
Print "Hoop Passed Successfully!"
Inc HoopsPassed
Hoop2Passed=1
Endif
Endif
REMSTART
While Hoop3Passed=0
If object collision(1,3)
set cursor 0,15
Print "Hoop Passed Successfully!"
Inc HoopsPassed
Hoop3Passed=1
Endif
endwhile
While Hoop4Passed=0
If object collision(1,4)
set cursor 0,15
Print "Hoop Passed Successfully!"
Inc HoopsPassed
Hoop4Passed=1
Endif
endwhile
While Hoop5Passed=0
If object collision(1,5)
set cursor 0,15
Print "Hoop Passed Successfully!"
Inc HoopsPassed
Hoop5Passed=1
Endif
endwhile
Set Cursor 0,0 : Print "Hoops Passed " ;HoopsPassed
REMEND
REMSTART
for c=2 to 5
if object collision(1,c)=1
set cursor 0,0
print "Hoop Passed Successfully!"
inc HoopsPassed
set cursor 0,15
Print "Hoops Passed" ;HoopsPassed
sync
endif
next c
REMEND
return
_Load_Game_Media:
HoopsPassed=0
Hoop2Passed=0
Hoop3Passed=0
Hoop4Passed=0
Hoop5Passed=0
Load object "gun.3ds",1
load image "grass.bmp",1
Load Image "sky.bmp",2
return