Sorry your browser is not supported!

You are using an outdated browser that does not support modern web technologies, in order to use this site please update to a new browser.

Browsers supported include Chrome, FireFox, Safari, Opera, Internet Explorer 10+ or Microsoft Edge.

DarkBASIC Discussion / Collision help

Author
Message
vulcan
18
Years of Service
User Offline
Joined: 5th Nov 2006
Location:
Posted: 12th Nov 2006 02:27
ok i've had db for about two weeks and im still new and i cant figure out how to make collision for all the objects, i\'ve been tryin some collision cammands but they haven\'t worked. so if anyone could explain this to me, that would be great
heer is what i have so far

sync on
sync rate 30

rem load images
load image \"metal_crackle.bmp\",1
load image \"GRASS09.BMP\",2
load image \"plate_rusted.bmp\",3

rem make and texture the inside matrix
make matrix 1,1000,1000,20,20
Prepare matrix texture 1,1,1,1
fill matrix 1,0,1

rem make and texture the outside matrix
make matrix 2,1000,1000,20,20
prepare matrix texture 2,2,1,1
fill matrix 2,0,1
POSITION MATRIX 2,1000,0,0

rem make windows
make object plain 4,50,50
position object 4,1000,200,250

rem Make three walls to create one with an opening for a door
rem make wall
make object box 1,500,500,0
position object 1,1000,200,250
yrotate object 1,90
texture object 1,3
Set object collision to boxes 1

rem make wall
make object box 3,110,360,0
position object 3,1000,270,550
yrotate object 3,90
texture object 3,3
Set object collision to boxes 3

rem make wall
make object box 2,400,500,0
position object 2,1000,200,800
yrotate object 2,90
texture object 2,3
Set object collision to boxes 2

rem load player
load object \"idle.x\",4
append object \"Walk.x\",4,21
loop object 4,0,20 : set object speed 4,10
set object collision to boxes 4

Rem Main loop
DO
set cursor 0,0
print X#
print Y#
print Z#

Rem Store Object angle
AngleY# = object angle Y(4)

Rem Control input for camera
If Upkey()=1
XTest# = Newxvalue(X#,AngleY#,20)
ZTest# = Newzvalue(Z#,AngleY#,20)
If XTest#>0 and XTest#<10000 and ZTest#>0 and ZTest#<10000
Move object 4,-10
Endif
Endif

If Downkey()=1
XTest# = Newxvalue(X#,AngleY#,20)
ZTest# = Newzvalue(Z#,AngleY#,20)
If XTest#>0 and XTest#<10000 and ZTest#>0 and ZTest#<10000
Move object 4,10
Endif
Endif

If Leftkey()=1 then Yrotate object 4,Wrapvalue(AngleY#-5)
If Rightkey()=1 then Yrotate object 4,Wrapvalue(AngleY#+5)
X# = Object position x(4)
Z# = Object position z(4)
Y# = Get Ground Height(1,X#,Z#)
Position object 4,X#,Y#+0.0,Z#
CameraZ# = Newzvalue(Z#,AngleY#+360,100)
CameraX# = Newxvalue(X#,AngleY#+360,100)
CameraY# = Get Ground Height(1,CameraX#,CameraZ#)
Position camera CameraX#,CameraY#+50,CameraZ#
Point camera X#,Y#+25,Z#

Rem Refresh Screen
Sync
Loop
ruben
19
Years of Service
User Offline
Joined: 22nd Nov 2005
Location:
Posted: 15th Nov 2006 17:05
Maybe you could look in the codebase, there are some collion programs there (mine too ). Or try the darkbasic sliding collision example.
Sun God
18
Years of Service
User Offline
Joined: 5th Jan 2007
Location: Don\'t ask me.
Posted: 6th Jan 2007 21:25
i've only had db classic for a couple of weeks as well. I've got a mate that tells me that if i had to do a collision for all objects than to do the 1st copy i.e

then copy and paste for all the other objects.
Thats all i can help really. I wish i knew for definate
Good luck

I'll be back before you can say "Antidisestablishmentarrianism"-Blackadder
"urm.. i don't think so.. Antidisestablism.. Anti.." Prince George
You'll all be KYKED!!

Login to post a reply

Server time is: 2025-05-25 22:28:44
Your offset time is: 2025-05-25 22:28:44