All pastes #2046035 Raw Edit

Something

public text v1 · immutable
#2046035 ·published 2011-04-13 15:18 UTC
rendered paste body
		// 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();
		}