Could someone have a look at my code and tell me why my player object falls through the floor???
rem sync etc
sync on
sync rate 40
hide mouse
rem setting up object variables
obj=1
obj2=500
obj3=1000
x#=100
y#=-25
z#=0
make object sphere 2000,5
position object 2000,x#,y#,z#
make object collision box 2000,-2.5,-2.5,-2.5,2.5,2.5,2.5,0
rem make level
for y=1 to 5
for x=1 to 15
rem read data
read a
rem reads data and decides what to do with it
if a=1
obj=obj+1
make object cube obj,10
position object obj,x*10,y*-10,0
color object obj,rgb(255,0,0)
make object collision box obj,-5,-5,-5,5,5,5,0
endif
if a=2
obj2=obj2+1
make object sphere obj2,10
position object obj2,x*10,y*-10,0
make object collision box obj2,-5,-5,-5,5,5,5,1
color object obj2,rgb(0,0,255)
endif
if a=3
obj3=obj3+1
make object cylinder obj3,10
position object obj3,x*10,y*-10,0
set object collision to boxes obj3
color object obj3,rgb(0,255,0)
make object collision box obj3,-5,-5,-5,5,5,5,0
endif
rem finishes the for/next commands
next x
next y
rem colours the backdrop
color backdrop 0
grav#=2.0
do
rem old positions
oldx#=object position x(2000)
oldy#=object position y(2000)
rem controls
if rightkey()=1
x#=x#+2.5
position object 2000,x#,y#,z#
endif
if leftkey()=1
x#=x#-2.5
position object 2000,x#,y#,z#
endif
if downkey()=1
y#=y#-2.5
position object 2000,x#,y#,z#
endif
if upkey()=1
y#=y#+2.5
position object 2000,x#,y#,z#
endif
rem collision stuff
if object collision(2000,0)
position object 2000,oldx#,oldy#,0
grav#=0.0
endif
rem get player position and store in x# and z#
x#=object position x(2000)
z#=object position z(2000)
y#=object position y(2000)
rem some gravity stuff
grav#=grav#-0.1
y#=y#+grav#
rem position the camera
position camera curvevalue(x#,camera position x(),5),curvevalue(y#,camera position y(),5),-60
rem position the object
position object 2000,x#,y#,z#
sync
loop
rem the data
data 1,1,1,1,1,1,1,1,1,1,1,1,1,1,1
data 1,0,0,0,0,0,1,0,0,0,0,0,0,0,1
data 1,0,2,0,3,0,0,0,3,0,3,0,2,0,1
data 1,0,0,0,0,0,0,0,0,0,0,0,0,0,1
data 1,1,1,1,1,1,1,1,1,1,1,1,1,1,1
thanks in advance
'You were born crying while people around you smiled'