• Advertisement
Sign in to follow this  
  • entries
    6
  • comments
    10
  • views
    2252

To Pong Or Not To Pong

Sign in to follow this  

244 views

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.
Sign in to follow this  


3 Comments


Recommended Comments

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.

Share this comment


Link to comment

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

  • Advertisement