🎉 Celebrating 25 Years of GameDev.net! 🎉

Not many can claim 25 years on the Internet! Join us in celebrating this milestone. Learn more about our history, and thank you for being a part of our community!

collision detection in 2d

Started by
1 comment, last by GameDev.net 24 years, 6 months ago
Ok, first, I've never done this before, but I think you have to store somewere the places your car can be or not; one possible way (and probably the easiest) would be to have a bitmap with white (or black) representing where the car can be, so to know whether you could (or couln't) move the care to a x,y position you would just check if that pixel was white. Of course, there are allways other ways, although less practical, like the defining the edges of the track line segments and checking wether the car would be to the left/right of that line segment (only one side would be valid) This would mean a lot of calculation, defining wich segment you would refer to, etc.

hope that helped

Advertisement
I want to make a top-view race game .
My background shows the landscape and the track.
Now I need to tell the computer where the car can go to and where not.
In some commercial games i've seen a second background just painted black and white(the track). Is this the way it has to be done ?
And how?

please try to help me !

Check out the 2D collision sample here:
http://www.darwin3d.com/gdm1999.htm

Maybe it will give you some ideas :-)

This topic is closed to new replies.

Advertisement