Hints on handling the collisions.

In the "flat" code for the "Obstacle" example you are given the function

  bool IntersectRects( const Rect& r1, const Rect& r2 ){
    return ! ( r1.bottom < r2.top  ||
		       r2.bottom < r1.top  ||
		       r1.right  < r2.left ||
		       r2.right  < r1.left  );
  }
that returns true is the Rects r1, r2 intersect, and false otherwise. This function makes detecting collisions very straightforward. Namely, you only need to prepare the two Rects bounding the two objects you want to check for an overlap, and give them to this function. To make a struct Rect out of four coordinates, you can use the standard CoreTools function
  Rect MakeRect( int x1, int y1, int x2, int y2 ); 
For example, a ball with the center at (x,y) and radius r is bounded by the rectangle with the corners (x-r,y-r) and (x+r,y+r). The corresponding struct Rect will be made and returned by
  MakeRect( x-r, y-r, x+r, y+r ) 
  1. Collision between a ball and a wall:
    Suppose the wall has the coordinates left, top, right, bottom. The next position of the ball is (nx, ny) where nx = x + vx and ny = y + vy . So they will collide if the rectangles made by
      
      MakeRect( left, top, right, bottom )   and
      MakeRect( nx-r, ny-r, nx+r, ny+r )
      
    overlap. Detecting this collision is all that
     bool Ball::Collides( const Wall& w ); 
    needs to do.
  2. Collision between a ball and another ball:
    Suppose we have our ball and another ball b. Then you can treat the other ball as a wall (yes, this is an ugly hack, but it works). So if nx, ny are the next coordinates of our ball as before, we only need to check for the overlap of the rectangles made by
      MakeRect( nx-r, ny-r, nx+r, ny+r )  and
      MakeRect( b.x - b.r, b.y - b.r, b.x + b.r , b.y + b.r )
      
    The second rectangle is the one that bounds the other ball b. Checking if these two rectangles overlap is all that
     bool Ball::Collides( const Ball& b ); 
    needs to do.
For the code that handles the reflection of a ball off a rectangular wall ("obstacle"), see the "flat" code in the Obstacle folder in the course directories on Ambassador. Use the same trick to reflect a ball off another ball -- pretend that the other ball acts as a wall.