I am trying to get it so that when the beach ball hits one of the platforms, everything gets deleted, except for the floor platform and the character. This is what I have:
autocam off
sync on
sync rate 60
hide mouse
desktopwidth=desktop width()
desktopheight=desktop height()
set display mode desktopwidth,desktopheight,32,1
maximize window
color backdrop rgb(255,255,255)
gosub _player
gosub _level1
load image "Media\grass_T.bmp",1
load image "Media\character.bmp",2
load image "Media\finish.bmp",3
load image "Media\lead.bmp",4
load image "Media\oldwood.bmp",5
step_var = 1
Distance101 = 60
Distance102 = 80
do
step_var = wrapvalue(step_var-1)
position object 101,240,Distance101*cos(step_var)+60,0
position object 125,0,Distance102*cos(step_var)+400,60
for a = 1 to 9
if object exist(a+100)
texture object a+100,4
endif
next a
for b = 96 to 99
if object exist(b)
texture object b,5
endif
next b
texture object 1,2
if object exist(100)
texture object 100,1
endif
if object exist(112)
texture object 112,4
endif
for f=114 to 125
if object exist(f)
texture object f,4
endif
next f
if object exist(126)
texture object 126,3
endif
if upkey()=1 then move object 1,0.8
if leftkey()=1 then yrotate object 1,wrapvalue(object angle y(1)-2.5)
if rightkey()=1 then yrotate object 1,wrapvalue(object angle y(1)+2.5)
if spacekey()=1 and playergrav#=0.0 then playergrav#=2.2
angle#=object angle y(1)
camdist#=25.0 : camhigh#=5.0 : camfade#=3
set camera to follow posx#,posy#-20,posz#,angle#,camdist#,camhigh#,camfade#,1
posx#=object position x(1)
posy#=object position y(1)
posz#=object position z(1)
cposx#=camera position x()
cposy#=camera position y()+10
cposz#=camera position z()
position object 2,cposx#,cposy#,cposz#
playergrav#=playergrav#-0.1
posy#=posy#+playergrav#
if level1=1
if object collision (1,126)=1
for d=101 to 126
delete object d
next d
gosub level2
endif
endif
position object 1,posx#,posy#,posz#
if object collision(1,0)>0
dec posx#,get object collision x()
dec posy#,get object collision y()
dec posz#,get object collision z()
if get object collision y()<0 then playergrav#=0.0
endif
if object collision(2,0)>0
dec cposx#,get object collision x()
dec cposy#,get object collision y()
dec cposz#,get object collision z()
endif
position camera cposx#,cposy#,cposz#
position object 1,posx#,posy#,posz#
xrotate camera 15
sync
loop
_player:
make object sphere 1,10
position object 1,0,20,-25
make object collision box 1,-5,-5,-5,5,5,5,0
if object exist(2)=0
make object cube 2,1
make object collision box 2,-0.5,-0.5,-0.5,0.5,0.5,0.5,0
hide object 2
endif
return
````````````````````````````
```````````Level1```````````
````````````````````````````
_level1:
level1=1
make object box 100,1000,5,1000
position object 100,0,-50,0
make object collision box 100,-10000,-2.5,-10000,10000,2.5,10000,0
make object box 101,40,5,40
position object 101,240,-40,0
make object collision box 101,-20,-2.5,-20,20,2.5,20,0
for a = 1 to 4
make object box a+101,40,5,40
position object a+101,(a*60)-60,(a*15)-50,0
make object collision box a+101,-20,-2.5,-20,20,2.5,20,0
next a
for a = 1 to 4
make object box a+105,40,5,40
position object a+105,(a*60)-60,(a*-15)+190,0
make object collision box a+105,-20,-2.5,-20,20,2.5,20,0
next a
make object box 114,40,5,40
position object 114,0,190,60
make object collision box 114,-20,-2.5,-20,20,2.5,20,0
for a = 1 to 4
make object box a+114,40,5,40
position object a+114,(a*60)-60,(a*15)+190,120
make object collision box a+114,-20,-2.5,-20,20,2.5,20,0
next a
make object box 119,40,5,40
position object 119,180,265,60
make object collision box 119,-20,-2.5,-20,20,2.5,20,0
for a = 1 to 4
make object box a+119,40,5,40
position object a+119,(a*-60)+240,(a*15)+265,0
make object collision box a+119,-20,-2.5,-20,20,2.5,20,0
next a
make object box 125,40,5,40
position object 125,180,340,0
make object collision box 125,-20,-2.5,-20,20,2.5,20,0
make object box 126,40,5,40
position object 126,0,470,0
make object collision box 126,-20,-2.5,-20,20,2.5,20,0
return
level2:
return
The thing is though, it's not working! Any ideas why?
This is the part in my code that is supposed to do that:
if level1=1
if object collision (1,126)=1
for d=101 to 126
delete object d
next d
gosub level2
endif
endif
Why do they turn against me? Especially when i need them the most?