Guest User

Untitled

a guest
Jul 30th, 2012
36
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1.             // As longas the ball is to the right of the back, check for an update
  2.             if (ballPosition.X > leftBat.BatPosition.X)
  3.             {
  4.                 // When the ball and bat collide, draw the rectangle where they intersect
  5.                 BatCollisionRectLeft();
  6.             }
  7.  
  8.             // As long as the ball is to the left of the back, check for an update
  9.             if (ballPosition.X < rightBat.BatPosition.X)
  10.  
  11.             {   // When the ball and bat collide, draw the rectangle where they intersec
  12.                 BatCollisionRectRight();
  13.             }
  14.  
  15.  
  16.  
  17.  
  18.  
  19.         /// <summary>
  20.         /// Used to determine the location where the particles will initialize when the ball and bat collide
  21.         /// </summary>
  22.         private void BatCollisionRectLeft()
  23.         {
  24.             // For the left bat
  25.             if (ballRect.Intersects(leftBat.batRect))
  26.             {
  27.                  rectangle3 = Rectangle.Intersect(ballRect, leftBat.batRect);
  28.             }
  29.         }
  30.  
  31.         /// <summary>
  32.         ///Checks for collision of Right Bat
  33.         /// </summary>
  34.         private void BatCollisionRectRight()
  35.         {
  36.             // for the right bat
  37.             if (ballRect.Intersects(rightBat.batRect))
  38.             {
  39.                 rectangle3 = Rectangle.Intersect(ballRect, rightBat.batRect);
  40.             }
  41.         }
RAW Paste Data