Welcome, Guest. Please login or register. Did you miss your activation email?

Author Topic: Programming a billard game  (Read 2155 times)

0 Members and 1 Guest are viewing this topic.

Roy301

  • Newbie
  • *
  • Posts: 1
    • View Profile
Programming a billard game
« on: March 23, 2016, 07:38:37 pm »
Hello,
I'm programming a litte billard game. I have the problem that i only know how to check for a collision between specific balls but i have already created a std::list for the balls. How can i  now check for collision between any balls in this list?

Source Code:

main.cpp
http://pastebin.com/wASBRcP3

Framework.cpp
http://pastebin.com/GtVs3ZBp
Framework.hpp
http://pastebin.com/YJnyA2ei

BallManager.cpp
http://pastebin.com/7xQd1wWp
BallManager.hpp
http://pastebin.com/0tXtHmes

Ball.cpp
http://pastebin.com/3QeTjwgx
Ball.hpp
http://pastebin.com/swruyw1C

Jesper Juhl

  • Hero Member
  • *****
  • Posts: 1405
    • View Profile
    • Email
Re: Programming a billard game
« Reply #1 on: March 23, 2016, 08:03:52 pm »

ka0s420

  • Jr. Member
  • **
  • Posts: 56
    • View Profile
    • Email
Re: Programming a billard game
« Reply #2 on: March 23, 2016, 08:57:24 pm »
When checking collisions against balls in a list, the main problem ive encountered with this approach is that the ball you are checking will always be in collision with itself, so the first thing to do is remove the ball you are checking from the list, then iterate through said list checking against the balls in the list, then when you've done that, put the ball back in the list.