Introducing Pymunk
We will implement physics in our game with Pymunk, a 2D physics engine built on top of Chimpunk2D.
Even though we are using OpenGL for 2D graphics, our platformer game will recreate a two-dimensional space, so we will work on the plane in which the z axis equals 0.
You can install Pymunk directly from pip
:
$ pip install pymunk
The Chimpunk2D library is written in C, so you might need to compile it on your platform if the distribution does not ship with the precompiled library. On 32-bit Windows and 32-bit and 64-bit Linux versions, Pymunk will include the Chimpunk2D binaries.
For other platforms, or if you want to compile the library yourself, you can check out the installation guide and the steps for compiling Chimpunk2D at http://pymunk.readthedocs.org/en/latest/installation.html.
Tip
Don't reinvent the wheel!
Implementing a rigid body library is a laborious task, especially if you are developing a casual game from scratch—as we are doing in this chapter.
Fortunately, the...