Search Results

Search found 1 results on 1 pages for 'chakotay'.

Page 1/1 | 1 

  • Pygame - CollideRect - But How Do They Collide?

    - by Chakotay
    I'm having some trouble figuring out how I can handle collisions that are specifically colliding on the top or bottom a rect. How can specify those collisions? Here's a little code snippet to give you an idea of my approach. As it is now it doesn't matter where it collides. # the ball has hit one of the paddles. send it back in another direction. if paddleRect.colliderect(ballRect) or paddle2Rect.colliderect(ballRect): ballHitPaddle.play() if directionOfBall == 'upleft': directionOfBall = 'upright' elif directionOfBall == 'upright': directionOfBall = 'upleft' elif directionOfBall == 'downleft': directionOfBall = 'downright' elif directionOfBall == 'downright': directionOfBall = 'downleft' Thanks in advance. **EDIT** Paddle rect: top ____ | | | | | | Sides | | ---- bottom I need to know if the ball has hit either the top or the bottom.

    Read the article

1