To Pong Or Not To Pong

Published March 27, 2005
Advertisement
Well my experience with SDL is growing but I have no idea how to do the collision detection. I think a bit of research is in order because at the moment I have 2 static paddles and a stationey ball on the screen.
Previous Entry About Me
Next Entry Can I Get A Rewind
0 likes 3 comments

Comments

johnhattan
there are tons of ways to do collision detection. The simplest way is to just check if the bounding boxes (the smallest containing rectangle) of your bitmaps overlap. That's fast to do, but it's a problem if you're using something like circles, because their boxes can overlap even if they're not actually touching.

Checking to see if the pixels of one object touch the pixels of another is the most accurate, obviously, but it can be a very slow process.

Google around for 2D collision detection, and you should find some stuff to read. Be sure to look for 2D collision detection, because 3D collision detection is even more documented, but the topics are pretty unrelated.
March 27, 2005 08:18 AM
Fantasy
Thanks for the advice. I'll be working on this one late tonight.
March 27, 2005 04:43 PM
Rob Loach
Enjoy

I definately use the bounding box or bounding circle approach though.
March 27, 2005 09:14 PM
You must log in to join the conversation.
Don't have a GameDev.net account? Sign up!
Profile
Author
Advertisement

Latest Entries

A Slight Hitch

648 views

Taking It Steady

761 views

Can I Get A Rewind

591 views

About Me

694 views

Found A Partner

575 views
Advertisement