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.

Dark GDK / Hey need help with collision

Author
Message
programing maniac
16
Years of Service
User Offline
Joined: 19th Apr 2008
Location: Bawk, Bawkity
Posted: 22nd Apr 2008 16:17
I am trying to make a game where things bounce off other things.

I know how to set an objects collision on, but how do you set what it does when it gets a collision???
Core2uu
16
Years of Service
User Offline
Joined: 15th Mar 2008
Location: Saskatoon, SK, Canada
Posted: 23rd Apr 2008 01:34
You can't simply "set" it... You have to code what happens when a collision occurs...

For example:

if (dbObjectCollision (1, 2))
{dbYRotateObject (1, 180);}

The code above, when Object 1 collides with 2, turns object 1 the opposite way and assuming the object is traveling along the X axis and you have two instances of object 2 on either side, the object will travel and bounce back between the two... The code above is following the ball bouncing back and forth model... But the point is you have to code your own event handler...

~~Core2uu~~
programing maniac
16
Years of Service
User Offline
Joined: 19th Apr 2008
Location: Bawk, Bawkity
Posted: 23rd Apr 2008 02:16
Quote: "if (dbObjectCollision (1, 2))
{dbYRotateObject (1, 180);}
"

Thanks, thats what I needed to know!

Login to post a reply

Server time is: 2024-11-20 07:29:04
Your offset time is: 2024-11-20 07:29:04