// does the ball hit the left paddle? if(ball.x - ball.radius < p1.x + paddle.width && ball.y + ball.radius >= p1.y && ball.y - ball.radius <= p1.y + paddle.height ) { ball.speedX *= -1.1; // does the ball hit the left wall? } else if (ball.x - ball.radius <= p1.x + paddle.width) { p2.score++; new_ball(); } // does the ball hit the right paddle if(ball.x + ball.radius > p2.x && ball.y + ball.radius >= p2.y && ball.y - ball.radius <= p2.y + paddle.height ) { ball.speedX *= -1.1; // does the ball hit the right wall? } else if(ball.x + ball.radius >= p2.x) { p1.score++; new_ball(); }