08-05-2013, 02:21 PM
Code:
#Bounce off paddles with VERY sucky collision detection
if self.pos[0] <= PADDLE_WIDTH + BALL_RAD:
if (self.pos[1] >= playerPaddle.pos[1]) and (self.pos[1] <= playerPaddle.pos[1] + PADDLE_HEIGHT):
self.velocity = (-(self.velocity[0] + angle_mod), self.velocity[1] + angle_mod)
self.pos = (PADDLE_WIDTH + BALL_RAD + 1, self.pos[1])
if (self.pos[0] >= screen.get_size()[0] - (PADDLE_WIDTH + BALL_RAD)):
if (self.pos[1] >= aiPaddle.pos[1]) and (self.pos[1] <= aiPaddle.pos[1] + PADDLE_HEIGHT):
self.velocity = (-(self.velocity[0] + angle_mod), self.velocity[1] + angle_mod)
self.pos = (screen.get_size()[0] - (PADDLE_WIDTH + BALL_RAD + 1), self.pos[1])
Whut.