I am writing a pong game with 1 paddle in pygame. The ball is supposed to bounce off the wall and the paddle. But the ball only sometimes bounces off the wall. Here is the code that makes the ball bounce:
elif ball_x == 785:
dbx = -dbx
elif ball_y == 585:
dby = -dby
elif ball_y == 15:
dby = -dby
elif ball_x == 60 and ball_y > rect1_y - 110 and ball_y < rect1_y + 110:
dbx = -dbx
How do I fix this?