Learn Create Your Own Split Screen

Next Page

Now let's think about the ball bouncing off the right hand edge of the canvas.

By examining this diagram, hopefully you can see the y-velocity is not at all changed by the bounce, but the x-velocity is reversed.

In fact, a bounce is just a reversal of a velocity. A bounce off either side involves a reversal of the x-velocity.