Create Your Own Animations

Learn the basics of computer animation before creating your own masterpiece.

If you’ve made it this far in the book, you’ve probably considered the ultimate gaming hack at some point: writing your own game. Maybe you have a story best told through interactive fiction ( [Hack #85] ). Maybe not, though; some stories need more pictures than words.

Though the systems emulated in Chapter 1 all have fantastic limitations, creating similar games today is much, much easier. Faster computers, higher-level languages, and well-documented, reusable libraries make it easy to learn game programming. It’s still difficult to create a high-powered 3D shooter engine, but with a little practice, you can write a fun little 2D game in a weekend.

The easiest place to start is by putting graphics on the screen.

Installing Python and PyGame

There are dozens of programming languages that can produce games. We’ll explore Python (http://www.python.org/), an open source language that’s easy to learn, powerful, and used in many professional game-development studios. It also has the advantage of working with the excellent PyGame (http://www.pygame.org/) game-programming library.

If you’re using a Unix or Mac OS X system, you likely have Python installed already. If you’re using Windows, you’ll probably need to install it yourself. At the time of writing, the current stable release is Python 2.3.3. Download an installer for Windows or Mac OS X from the Python download page (http://www.python.org/download/ ...

Get Gaming Hacks now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.