Adding Collision Detection
First we need to work out how to stop the ball when it hits the opposite paddle. We do this using coordinates to work out if the ball has hit the left edge of the paddle. This is collision detection in action. We then want to make the ball change direction so it moves back across the board to the other paddle. We do this by adding two new methods to the code. Watch the ball bounce back and forth between the paddles.