Jump to content
  • Advertisement
Sign in to follow this  
  • entries
  • comments
  • views

To Pong Or Not To Pong

Sign in to follow this  


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  


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

Important Information

By using GameDev.net, you agree to our community Guidelines, Terms of Use, and Privacy Policy.

GameDev.net is your game development community. Create an account for your GameDev Portfolio and participate in the largest developer community in the games industry.

Sign me up!