1 Introduction


This tutorial is for anyone who wants to learn the basics of programming in Python and/or anyone who wants to know how to make a simple 2D video game. If you’re new to programming and want to make a bestselling AAA 3D title, then this may be the wrong place for you.. or maybe not, it could be a good place to start. In programming you need to learn how to walk before you can run, that means learning the basics of coding and understanding how a simple 2D game works.


You’ll be learning how to write simple Python programs and use the functions in the Pygame library, so that by the end you’ll put together a simple shoot-em-up video game.

You start off with a look at variables, which are containers for data, and their different types. Then there’s an explanation of operators, for example + – * / which are the arithmetic operators. This is followed by a look at if statements, which are comparison tests, for instance to check if the player is pressing the joypad fire button. There’s an introduction to loops which repeat sections of code based on certain conditions. After that it’s onto functions, which are self-contained sections of code, and fundamental building blocks of procedural programming. The section after this takes a quick look at object oriented programming, just covering those parts which are relevant to the example game. Then you learn some functions from the Pygame library, such as how to draw an image to the screen and how to play sound effects. Finally there’s the example game, which brings together and utilizes the knowledge you’ve learned throughout the tutorial.

<– back to contents