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 isn't working

Author
Message
dmurphy
14
Years of Service
User Offline
Joined: 2nd Oct 2009
Location:
Posted: 2nd Nov 2009 20:46
Hey something is wrong with the collision in my game. Any suggestions?

This is the code


Any help is good

Candy = good!
TDK
Retired Moderator
21
Years of Service
User Offline
Joined: 19th Nov 2002
Location: UK
Posted: 2nd Nov 2009 21:39
We can't run your program without the media, so we are only able to look at it - and to be honest, normally when I see Goto in a program I stop looking and not bother with the rest.

But as I've actually gone to the effort of cutting and pasting it into the DBC editor...

Suggestions:

1. Don't use:



...in a loop, just use:



As you are only checking when object 1 bumps into something else, using 0 will return the object number of whatever object 1 collides with.

2. Don't use Goto. It makes following a program (debugging) difficult and many people (including me) won't normally bother. It's possible that the way you use Goto can result in some sections of code not being called and it's not easy to spot.

Use subroutines or functions instead.

Useful Link:

Check Out Number 2 Here

(You might find the others useful at some point too)...

TDK

BN2 Productions
20
Years of Service
User Offline
Joined: 22nd Jan 2004
Location:
Posted: 2nd Nov 2009 21:40
Can't test it without the appropriate media, but try putting a SET GLOBAL COLLISION ON somewhere near the beginning.

Great Quote:
"Time...LINE??? Time isn't made out of lines...it is made out of circles. That is why clocks are round!" -Caboose

Login to post a reply

Server time is: 2024-05-04 00:56:22
Your offset time is: 2024-05-04 00:56:22