Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- public void Update
- {
- ....
- // When the ball and bat collide, draw the rectangle where they intersect
- BatCollisionRect();
- ....
- }
- /// <summary>
- /// Used to determine the location where the particles will initialize when the ball and bat collide
- /// </summary>
- public void BatCollisionRect()
- {
- // For the left bat
- if (ballRect.Intersects(leftBat.batRect))
- {
- rectangle3 = Rectangle.Intersect(ballRect, leftBat.batRect);
- hasHitLeftBat = true;
- if (hasHitLeftBat == true)
- {
- hasHitRightBat = false;
- }
- }
- // for the right bat
- if (ballRect.Intersects(rightBat.batRect))
- {
- rectangle3 = Rectangle.Intersect(ballRect, rightBat.batRect);
- hasHitRightBat = true;
- if (hasHitRightBat == true)
- {
- hasHitLeftBat = false;
- }
- }
- }
RAW Paste Data