   dynamic collision detection(2d)
  Hey guys, I am trying to make a class that detects collision for n amount of entities. I am having trouble figuring out how to do this. I was thinking something around:class collision{    public:   void add_entity(SDL_Rect);   // adds entity   int check_collision(SDL_Rect);   // returns int based on collision, and where}But I'm not sure how to impliment it, any suggestions, tips, tutorials, etc. would be greatly appreciated.Joe   
  You may be interested in the two N Tutorials on the topic -- Basic Collision Detection and Response and Grid-Based Collision Detection and Raycasting -- the second of which is probably more relevant to your current problem.  The in-text snippets and provided sample code are in ActionScript but shouldn't be overly difficult for you to follow, and the actual explanations are quite well written.  Check out the reference links at the bottom of the articles as well.  There are also a number of collision detection articles here at GDNet, but I've not read them and so can't recommend any in particular or comment on their quality or relevance.Hope that helps. [smile]   