Simple Python Game Tutorial Using Classes

Simple Python Game with ClassesPython is a great language, especially for beginners. Once you get a few concepts under your belt, you naturally want to start making some games! If you are just getting started, you will want to check out my previous (simpler) tutorial called A Simple Python Turtle Graphics Game. This tutorial is similar to the first one, but uses Classes to simplify the code.

 

Note: This tutorial was written in Python 2.7 / 3.5 on a Mac - the code (except for the code that plays a sound) should work fine on other platforms as well using the standard Python modules.

The Game

In this game, players are in control of a spaceship inside of an arena of unknown origin.  Also trapped inside the arena are goals that fly around at random.  The player's job is to fly around and touch as many of the goals as possible. When a goal is touched, it disappears and reappears at a random position in the arena. The commands are simple, the left arrow key rotates the ship left, the right arrow key rotates the ship right, and the up key accelerates. 

The Tutorial

Intro: Introduction and Overview

Part 1: Getting Started

Part 2: Keyboard Binding / Turning the Turtle

Part 3: Adding Borders / Border Checking

Part 4: Adding and Moving a Goal

Part 5: Collision Checking Function

Part 6: Multiple Goals and Performance

Part 7: Scoring

Part 8: Background Image / Sound (Mac Only)

Part 9: Turtle Image

Resources and Source Code Coming Soon!

Comments

Post new comment

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

@TokyoEdTech

Poll

What LMS does your school use?: