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.

2D All the way! / Collisions

Author
Message
The Scorpion
21
Years of Service
User Offline
Joined: 12th Oct 2002
Location: United States
Posted: 24th Oct 2002 05:17
I'm having problems with collisions...see I have it test right? so it places the object to it's original position before it collided. Well...if I move the objects pixel by pixel then it is really slow. So i have them move more. But with this then there is a big gap of space between objects when they so called collided. How can I fix this? I have a variable called speed which controls how many pixels the object moves I have a function controlling my collisions. But it seems to me that functions use their own internal variables rather than the global ones. Anyone have any suggestions? (Hmm I guess I was stupid to switch from C++).
obese
21
Years of Service
User Offline
Joined: 15th Oct 2002
Location:
Posted: 27th Oct 2002 16:53
what method of collision are you using? i assume you're using math collision, but boxes, circles?

i you are using box collision, you should have an array of all the boxes' data so you can check for collision by the main object.
for each box, stored in an array, i have the center coordinates, half width, and half height. just position the object at the center coordinates of the box plus/minus(depending what side of box it is on) the width/height(again, depending on side) and then if the colliding object has a width or height, add that too.

i hope that answers your ?.

*\OBESE/*

Login to post a reply

Server time is: 2024-03-29 09:56:21
Your offset time is: 2024-03-29 09:56:21