Anyone who has any experience with Pygame
Can they explain to me how pygame.Rect.colliderect() works? I was playing around with Python, recreating Pong using in order to get into the mindset for my 11 Computer Science course starting next week, but I can't figure out how to get these to work the way I intend
It's basically this
def check_collision (self, ball):
if self.colliderect(ball):
ball.reflect_x() x component
ball.reflect_y() y component
...
while True:
*quitting event foreach loop*
refers to a list of the two paddles on either end of the screen
for paddle in paddles:
*update their position*
paddle.check_collision (ball)
*draw and update*
But for some reason the call never seems to return True or something. Halp.
January 28, 2014