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 / I got a question....lol

Author
Message
CKANE618
19
Years of Service
User Offline
Joined: 4th Dec 2006
Location:
Posted: 6th Dec 2006 02:48
Hey...in object collisions... do you need to reset any odd variables or objects that I am not aware of??? I have this in my code...

make object sphere 1,25
make object box 2, 300,15, 2
make object box 3, 300,15, 2
make object box 4, 300,15, 2
...
position object 2,-30,60,250
...
position object 3,30,-7,250
...
position object 4,-30,-75,250
..then I call within a do loop the
position object 1 with decrimenting position to have the sphere
fall from top left to bottom.

Then I call a collision function within the do loop like this
FUNCTION Collision()
if object hit(1,2) > 0
play sound 3
wait key

endif
if object hit(1,3) > 0
play sound 3
wait key
endif
if object hit(1,4) > 0
play sound 3
wait key
endif
ENDFUNCTION

but it only works on object 1 and 2. It still falls through object 3. However, if I remove object 2 from the screen by commenting the code, then it works with object 3 but not 4...etc. Any ideas or help would be appreciated.

Thank you.

Chris
CKANE618
19
Years of Service
User Offline
Joined: 4th Dec 2006
Location:
Posted: 6th Dec 2006 05:23
I have an answer too....

for some reason it just would not work for more than 2 objects. SO I put in a function for each object such as
FUNCTION Collision1()
position object 2,-30,60,250
if object collision(1,2) > 0
play sound 3

endif
ENDFUNCTION

with placement contained within the function...and sure enough, it works. I made 3 identicle functions but with different object placements and DB is happy and working correctly.
Lukas W
22
Years of Service
User Offline
Joined: 5th Sep 2003
Location: Sweden
Posted: 8th Dec 2006 12:35
it would be easier to just make one function for that, something like:


Login to post a reply

Server time is: 2026-07-08 10:38:17
Your offset time is: 2026-07-08 10:38:17