Video Tutorial: Python Spacewar Game

Spacewar OriginalSpacewar! was one of the earliest videogames, originally created on a PDP-1 in 1962! The original version did not have gravity or hyperspace options, but later versions did.  This tutorial walks you through the steps for creating a somewhat similar game using nothing more than the built-in turtle module. Note: this was coded in Python 2.7 on a Mac - other platforms, such as Linux, run much faster so you would need to add a delay to the main game loop.


The Program

We will be making a somewhat similar program - but as this tutorial is for relative beginners, we will simplify things a bit.

In this program you are tasked with destroying the red circles (your enemies) while avoiding shooting the blue squares (your allies).

Here is what the game will look like:

Spacewar Screenshot


The Tutorial

The tutorial is in 10 stages as follows:

STAGE I: VIDEO / CODE - Getting Started

STAGE II: VIDEO / CODE - Create the Player Class / Move the Player

STAGE III: VIDEO / CODE - Game Objects, Borders, and Boundary Checking

STAGE IV: VIDEO / CODE - Create Enemies / Collision Checking

STAGE V: VIDEO / CODE - Creating a Missile 

STAGE VI: VIDEO / CODE - Create an Ally

STAGE VII: VIDEO / CODE - Game Status / Scoring / Sound

STAGE VIII: VIDEO / CODE - Multiple Enemies / Multiple Allies

STAGE IX: VIDEO / CODE - Background Image/Window Title/Player & Missile Shape

STAGE X: VIDEO / CODE - A Simple Particle System for Explosions


Advanced Version (

The SpaceWar Demo version has more realistic spaceship physics, a splash screen and other graphics, and enemy and ally bases.

It looks like this:

SpaceWar Game Play

You can download it and all the sound files here.


Post new comment

The content of this field is kept private and will not be shown publicly.



What LMS does your school use?: