I am having a problem with the collision in my game. I have the collision working for my buildings just fine, but I wanted to add drops that you can pick up. These would be shperes with the same random generation code as the buildiings. They also have the collision set to polygons. (I normally use collision boxes but Chafari used polygons as he was helping us with the collision on our buildings). The building collision works fine but I want it so that when you collide with the spheres it dissapears and it increases my boost number by 20.

REM edutainment
REM by abbas and sam
REM created 12/2/13 10:11 a.m.
autocam off
hide mouse
rem ****____****____title intro thing____****____****
center text 320,240, "Welcome to a Friend in Need"
ink rgb(0,20,255),0
center text 321,241, "Welcome to a Friend in Need"
ink rgb(255,255,255),0
center text 320,260, "A Game About Transfering Energy"
ink rgb(0,20,255),0
center text 321,261, "A Game About Transfering Energy"
ink rgb(255,255,255),0
center text 320,280, "Press [A] to Continue"
ink rgb(0,20,255),0
center text 321,281, "Press [A] to Continue"
ink rgb(255,255,255),0
do
if inkey$()="a"
do
if inkey$()<>"a" then cls : exit
loop
exit
endif
loop
ink rgb(255,255,255),0
center text 320,240, "Drive to Your Friend Who"
ink rgb(0,20,255),0
center text 321,241, "Drive to Your Friend Who"
ink rgb(255,255,255),0
center text 320,260, "Is Low On Energy,"
ink rgb(0,20,255),0
center text 321,261, "Is Low On Energy,"
ink rgb(255,255,255),0
center text 320,280, "Only You Can Save Him!!!"
ink rgb(0,20,255),0
center text 321,281, "Only You Can Save Him!!!"
ink rgb(255,255,255),0
center text 320,300, "Press [S] to Continue"
ink rgb(0,20,255),0
center text 321,301, "Press [S] to Continue"
ink rgb(255,255,255),0
do
if inkey$()="s"
do
if inkey$()<>"s" then cls : exit
loop
exit
endif
loop
center text 320,220, "********************"
ink rgb(0,20,255),0
center text 321,221, "********************"
ink rgb(255,255,255),0
center text 320,240, "Press [P] To Start"
ink rgb(0,20,255),0
center text 321,241, "Press [P] To Start"
ink rgb(255,255,255),0
center text 320,260, "********************"
ink rgb(0,20,255),0
center text 321,261, "********************"
ink rgb(155,255,255),0
do
if inkey$()="p"
do
if inkey$()<>"p" then cls :exit
loop
exit
endif
loop
rem ****____****_____loading section____****____****
load image "E:\My DarkBasicPro Games\Edutainment\images\sky_texture.jpg",1
load music "E:\My DarkBasicPro Games\Edutainment\sounds\car_revving.mp3",1
load sound "E:\My DarkBasicPro Games\Edutainment\sounds\car_explosion.wav",2
rem ****____****____MainSection Loop____****____****
MainSection:
make object cube 1,50
scale object 1, 15,20,20
color object 1, rgb(255,0,0)
position object 1,-500,-300,-500
rotate object 1,0,45,0
color backdrop rgb(25,0,100)
position camera 0,85,-5
point camera 0,60,60
set camera range 1,4000000000000
play music 1
loop music 1
set music volume 1, 65
set sound volume 2,90
rem ****____****____ other oject creation ____****____****
NumberOfBuildings = 75
for t = 1 to NumberOfBuildings
make object cube t + NumberOfBuildings ,100
scale object t +NumberOfBuildings,200,750,200
color object t + NumberOfBuildings , rgb(0,255,100)
position object t + NumberOfBuildings ,Rnd(7000)-950,30,Rnd(7000)-950
rem make object collision box t + NumberOfBuildings ,-100,-375,-100,100,375,100,0 rem ))))))))))))))
set object collision to polygons t + NumberOfBuildings
next t
NumberOfBuildings2 = 37
for x = 1 to NumberOfBuildings2
make object cube x + NumberOfBuildings2 ,150
scale object x +NumberOfBuildings2,250,200,275
color object x + NumberOfBuildings2 , rgb(100,0,100)
position object x + NumberOfBuildings2 ,Rnd(7000)-950,-200,Rnd(7000)-950
rem make object collision box t + NumberOfBuildings ,-100,-375,-100,100,375,100,0 rem ))))))))))))))
set object collision to polygons x + NumberOfBuildings2
next x
rem ****____****____Energy Orbs____****____****
NumberOfOrbs = 15
for a = 1 to NumberOfOrbs
make object sphere a + NumberOfOrbs ,50
color object a + NumberOfOrbs , rgb(255,255,255)
position object a + NumberOfOrbs ,Rnd(7500)-950,-325,Rnd(7500)-950
set object collision to polygons a + NumberOfOrbs
next a
make object cube 200,50
scale object 200,15,20,20
color object 200,rgb(0,0,255)
position object 200,Rnd(7000)-950,-200,Rnd(7000)-950
rem ****____****____ Collision and Motion Section ____****____****
BOOST# = 10000
HEALTH# = 10000
do
oldx#=x#
oldz#=z#
rem store angle
ay# = object angle Y(1)
rem key input
if upkey()=1 then move object 1,0.25
if downkey()=1 then move object 1,-0.25
if leftkey()=1 then ay# = wrapvalue(ay#-0.20)
if rightkey()=1 then ay# = wrapvalue(ay#+0.20)
if spacekey()=1 then move object 1,0.375 : cdn# = cnd# - 15
if inkey$()="q" then end
x#=object position x(1)
y#=object position y(1)
z#=object position z(1)
position object 1,x#,y#,z#
`sliding collision cheking
`-----------------------------------
if object collision(1,0)>0:gosub zzol
if object collision(1,0)=0:z#=oldz#
endif
endif
if object collision(1,0)>0:gosub xxol
if object collision(1,0)=0:x#=oldx#
endif
endif
if object collision(1,0)>0
x#=oldx#:z#=oldz#
endif
`------------------------------------
cdn# = 55
rem rotate object
yrotate object 1,ay#
set camera to follow object position x(1), object position y(1), object position z(1), object angle y(1), 5, 15, cdn#, 0
rem ****____****____ boost and health section ____****____****
boostout=BOOST#/100
healthout=HEALTH#/100
center text 320,425,"BOOST = " + str$(boostout)
center text 320,435, "HEALTH = " + str$(healthout)
if spacekey()=1 and BOOST#>0 then BOOST# = BOOST# - 1
if BOOST# < 1000
dec HEALTH#,1
endif
if HEALTH# = 0 then gosub EndSection:
loop
xxol:
POSITION OBJECT 1,oldx#,y#,z#
play sound 2
play music 1
loop music 1
HEALTH# = HEALTH# - 1
return
zzol:
POSITION OBJECT 1,x#,y#,oldz#
play sound 2
play music 1
loop music 1
HEALTH# = HEALTH# - 1
return
if HEALTH# = 0 : endif
EndSection:
REM DECLARE VARIABLES
REM SCREEN DISPLAY
stop music 1
stop sound 2
delete objects 1,6000
cls 0
wait key
center text 320,200,"YOU LOST!!!"
center text 320,240,"PLAY AGAIN [Y/N]?"
wait key
REM *** END SECTION LOOP
do
REM CONTROL INPUT
if Inkey$()="y"
gosub MainSection:
endif
if Inkey$()="n"
cls : end
endif
loop
wait key