Learn Create Your Own Split Screen

Next Page

Here's the finished code with a bit of x-velocity. It really is a thing of beauty.

The motion is an accurate simulation of things you may have been studying in physics or mathematics, called a parabola. You might have learned the mathematical formula for a parabola, and be wondering how the ball can be following a parabola when there's nothing in the code that looks anything like the right formula.

What we're doing is called a discrete simulation of the physical universe. It's how most games work.

(Some philosophers suspect the entire universe is just a simulation running in a supercomputer somewhere, and the physical quantity known as “Planck Length” is its pixel size. There’s even a fairly elegant line of reasoning to show that this is probably the case. But do your homework anyway.)