Guest User

Untitled

a guest
Jul 30th, 2012
30
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. public void Update
  2. {
  3.     ....          
  4.     // When the ball and bat collide, draw the rectangle where they intersect
  5.          BatCollisionRect();    
  6.     ....
  7. }  
  8.  
  9.     /// <summary>
  10.         /// Used to determine the location where the particles will initialize when the ball and bat collide
  11.         /// </summary>
  12.         public void BatCollisionRect()
  13.         {
  14.             // For the left bat
  15.             if (ballRect.Intersects(leftBat.batRect))
  16.             {            
  17.              rectangle3 = Rectangle.Intersect(ballRect, leftBat.batRect);
  18.              hasHitLeftBat = true;
  19.  
  20.               if (hasHitLeftBat == true)
  21.                  {
  22.                    hasHitRightBat = false;
  23.                  }
  24.             }
  25.  
  26.             // for the right bat
  27.             if (ballRect.Intersects(rightBat.batRect))
  28.             {
  29.                 rectangle3 = Rectangle.Intersect(ballRect, rightBat.batRect);
  30.                 hasHitRightBat = true;
  31.  
  32.                 if (hasHitRightBat == true)
  33.                   {
  34.                     hasHitLeftBat = false;
  35.                   }
  36.             }
  37.         }
RAW Paste Data