the blank screen is due to the fact that you never refresh it via the 'sync' command.
...
well, i'm still very new to DBP but i made the code work. here is the new code, remarked with the problems i found and some advice:
btw, i left out anything to do with the matrix and textures. my goal was to help you with the collision routine and to show you about how SYNC works
sync on
sync rate 0
hide mouse
width=100
depth=50
xtiles=20
ztiles=15
rem load image "mess.bmp",1
rem set up the cubes
for x= 1 to 20
make object cube x,100
position object x,rnd(2000),0,rnd(2000)
set object collision to boxes x
set object collision on x
rem - you need to set 'collision on' to make collisions work. there's also a
rem - 'set global collision on' command that should turn ALL collisions on in one fell swoop.
rem - if you choose to go that route, set it to 'on' just before you start your main do/loop
next x
make object sphere 100,50
rem - as mentioned, set player to object 100, not 10 since it's already used
set object collision to spheres 100
set object collision on 100
rem - turns the collision on
rem make matrix 1,width,depth,xtiles,ztiles
rem update matrix 1
rem set global collision on **this should work instead of turning each object's
rem collision on manually
rem prepare matrix texture 1,1,1,1
rem set matrix texture 1,1,1
rem ** move these out of your do/loop or it'll bug
do
color object 100,rgb(255,255,255)
rem this will color your sphere to 'white', denoting 'no collision'
ay#= object angle y(100)
if upkey()=1 then move object 100,1.0
rem - changed to using object 100 here again and slowed the speed to something
rem more appropriate
if leftkey()=1 then yrotate object 100,wrapvalue(ay#+0.5)
if rightkey()=1 then yrotate object 100,wrapvalue(ay#-0.5)
if downkey() = 1 then move object 100,-1.0
rem - added 'back up' to help get out of sticky 'collision' states.
x#= object position x(100)
rem - object changed to "100"
z#= object position z(100)
rem - same
rem - added basic collision routine here:
rem - this will check player object (100) against the 20 cubes each cycle of your do/loop
for cube = 1 to 20
if object collision(100,cube) = 1 then color object 100,rgb(255,0,0): position object 100,oldx#,0,oldz#:
rem - this is a boolean check. value = 0 or 1, so no real need to check against ">0"
rem - also changes sphere to red when collision detected
rem - you have to have an established 'safe' position for the object to be moved to
rem - if a collision is found. oldx# and oldy# is the last position where there was
rem - no collision
next cube
cz#= newzvalue(z#,ay#-180,100)
cx#= newxvalue(x#,ay#-180,100)
rem - the next couple lines define the last 'safe' place. it's updated constantly and
rem - since the above collision routine ensures your object is left in a 'safe' place,
rem - it's a quick and reliable (but very basic) way to accomplish your goal
rem - note, there is a chance your boxes and/or matrix will start off
rem - colliding with the sphere. make sure they don't by putting rem - more thought into your object/matrix placement code
oldx# = object position x(100)
oldz# = object position z(100)
position camera cx#,100,cz#
point camera x#,50,z#
set cursor 0,0
print screen fps()
rem - probably the most basic debugging/benchmark info here. helps you know 'how'
rem - things are working.
sync
rem - 'sync' keeps the screen up-to-date as mentioned. if you're not using
rem - 'sync off', you must SYNC the screen yourself/manually. best practice is to place this just
rem - before your 'loop' statement, to render the most up-to-date goings-on/information
loop
hope this helped. good luck
My Modest System:
Athlon XP1800+, Windows XP+SP2, Soyo K7V Dragon+ MB, 1.5Gb 333 RAM, ATI Radeon 8700LT (128Mb), Drivers and Updates Kept Current