Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- // As longas the ball is to the right of the back, check for an update
- if (ballPosition.X > leftBat.BatPosition.X)
- {
- // When the ball and bat collide, draw the rectangle where they intersect
- BatCollisionRectLeft();
- }
- // As long as the ball is to the left of the back, check for an update
- if (ballPosition.X < rightBat.BatPosition.X)
- { // When the ball and bat collide, draw the rectangle where they intersec
- BatCollisionRectRight();
- }
- /// <summary>
- /// Used to determine the location where the particles will initialize when the ball and bat collide
- /// </summary>
- private void BatCollisionRectLeft()
- {
- // For the left bat
- if (ballRect.Intersects(leftBat.batRect))
- {
- rectangle3 = Rectangle.Intersect(ballRect, leftBat.batRect);
- }
- }
- /// <summary>
- ///Checks for collision of Right Bat
- /// </summary>
- private void BatCollisionRectRight()
- {
- // for the right bat
- if (ballRect.Intersects(rightBat.batRect))
- {
- rectangle3 = Rectangle.Intersect(ballRect, rightBat.batRect);
- }
- }
RAW Paste Data