Hi there.
Same here, I never use collision boxes, and nowaday I use Sparkys but I remember some code I had for DBC that I adapted for Dbpro.
@Sir_Herbert
Here is your code with some modification and my collision subrutine.
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 Continoue"
ink rgb(0,20,255),0
center text 321,301, "Press [S] to Continoue"
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 DBPRO Games\Edutainment\images\sky_texture.jpg",1
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,-350,0,-350
rotate object 1,0,45,0
color backdrop rgb(0,0,0)
position camera 0,85,-5
point camera 0,55,60
set camera range 1,4000000000000
rem Walls
rem starting part of the arena
rem North Wall
make object box 4,2000,1000,10
rotate object 4,0,180,0
position object 4, 0,500,-1005
texture object 4,1
rem West Wall
make object box 5,2000,1000,10
rotate object 5,0,270,0
position object 5, -1005,500,0
texture object 5,1
rem Floor
make object box 6,2000,1000,2000 : position object 6,0,-500,0 : color object 6,rgb(0,0,255)
rem make object collision box 6,-1000,-500,-1000,1000,500,1000,0
set object collision off 6 rem ))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))
rem Walls
rem eastern bottom of the arena
rem east Wall
make object box 12,2000,1000,10
rotate object 12,0,270,0
position object 12, 3010,500,0
texture object 12,1
rem North Wall
make object box 14,2000,1000,10
rotate object 14,0,180,0
position object 14, 2000,500,-1005
texture object 14,1
rem Floor
make object box 15,2000,1000,2000 : position object 15,2000,-500,0 : color object 15,rgb(0,0,255)
rem make object collision box 15,-1000,-500,-1000,1000,500,1000,0
set object collision off 15 rem ))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))
rem Walls
rem top western part of the arena
rem North Wall
make object box 16,2000,1000,10
rotate object 16,0,0,0
position object 16, 0,500,3005
texture object 16,1
rem West Wall
make object box 17,2000,1000,10
rotate object 17,0,270,0
position object 17, -1000,500,2000
texture object 17,1
rem Floor
make object box 19,2000,1000,2000 : position object 19,0,-500,2000 : color object 19,rgb(0,0,255)
rem make object collision box 19,-1000,-500,-1000,1000,500,1000,0
set object collision off 19 rem ))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))
rem top eastern part of the arena
rem east Wall
make object box 20,2000,1000,10
rotate object 20,0,270,0
position object 20, 3010,500,2000
texture object 20,1
rem North Wall
make object box 21,2000,1000,10
rotate object 21,0,180,0
position object 21, 2000,500,3000
texture object 21,1
rem Floor
make object box 22,2000,1000,2000 : position object 22,2000,-500,2000 : color object 22,rgb(0,0,255)
rem make object collision box 22,-1000,-500,-1000,1000,500,1000,0
set object collision off 22 rem ))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))
rem ****____****____ other oject creation ____****____****
NumberOfBuildings = 25
for t = 1 to NumberOfBuildings
make object cube t + NumberOfBuildings ,100
scale object t +NumberOfBuildings,200,750,200
color object t + NumberOfBuildings , rgb(255,0,0)
position object t + NumberOfBuildings ,Rnd(3900)-950,30,Rnd(3900)-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
rem ****____****____ collision section ____****____****
rem ****____****____ Motion Section ____****____****
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)
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
`------------------------------------
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, 55, 0
loop
wait key
xxol:
POSITION OBJECT 1,oldx#,y#,z#
return
zzol:
POSITION OBJECT 1,x#,y#,oldz#
return
I'm not a grumpy grandpa
