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 / Object Collision Question

Author
Message
Ben Johnson
18
Years of Service
User Offline
Joined: 6th Jul 2007
Location:
Posted: 8th Jul 2007 23:41
I have been working on my game and I have come across a problem, is there a way to set a If object collision() and inside the brackets have something that sets it to object 1 to 60 or something like that?
TDK
Retired Moderator
23
Years of Service
User Offline
Joined: 19th Nov 2002
Location: UK
Posted: 9th Jul 2007 00:16
Try again, but make a little more sense this time please.

The only thing I worked out from your post was that you have a problem...

TDK_Man

Ben Johnson
18
Years of Service
User Offline
Joined: 6th Jul 2007
Location:
Posted: 9th Jul 2007 00:42
Sorry, I couldn't think of a way to put it, basically is there a way to enter more than two objects into something like "If object collision(1,x)". Like 1 to 5, so if object 1 collides objects 1 to 5 what ever happens in the if statement happens to them. Hope that makes more sense.

Ben
RUCCUS
21
Years of Service
User Offline
Joined: 11th Dec 2004
Location: Canada
Posted: 9th Jul 2007 02:30 Edited at: 9th Jul 2007 02:30
It sounds like he wants to check for collision with multiple objects. Use a for/next loop giving the loop's variable as the object to check. That, or get sparky's dll, and set up every object in the same group, and perform group collision.

Eg;



Look up loops for more info.


TDK
Retired Moderator
23
Years of Service
User Offline
Joined: 19th Nov 2002
Location: UK
Posted: 9th Jul 2007 06:39
Ah I see now... I think!

Say the main object is number 100 and you want to check for collision with objects 1 to 5 you would use:



But that's only for DB's built-in collision and probably not of use if you use Sparky's DLL as Ruccus suggested.

TDK_Man

RUCCUS
21
Years of Service
User Offline
Joined: 11th Dec 2004
Location: Canada
Posted: 9th Jul 2007 15:39
Groups in sparky's dll are easy to set up.

Every object that will be used with sparky's dll needs to be setup with the syntax:

SC_setupObject Object_Num , Group_Num , Collision_Type

There are various collision types, look into them in the help files. But the group num parameter is what forms the groups. If you have 2 objects, you could set them both up in the same group (any group number you want, except 0, 0 means no group).

SC_setupObject 1, 1, 1
SC_setupObject 2, 1, 1

Now both objects are in group 1. Sparky's dll has seperate group commands for every collision command there is. So now, instead of calling for example, the SC_sphereSlide command and giving 1 object number, you would call the SC_sphereSlideGroup command, and giving the group number 1.


Login to post a reply

Server time is: 2026-07-06 00:45:59
Your offset time is: 2026-07-06 00:45:59