Video Tutorial: A Simple Python Turtle Graphics Game
Seymour Papert and his colleagues invented the programming language Logo back in 1967. Generations of schoolchildren learned to move a little graphical turtle around their computer screens in order to learn the basic concepts behind coding. Python, an excellent programming language for beginners, includes a wonderful turtle graphics module that can be used to program any number of simple computer games.
In this video tutorial series, I will walk you through all the steps necessary to put some turtles on the screen and make a simple, yet fun little game out of them.
Note: This tutorial was written in Python 2.7 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.
In this game, players are in control of a spaceship inside of an arena of unknown origin. Also trapped inside the arena are mysterious alien orbs (your goals) that fly around at random. The player's job is to fly around and touch as many of the orbs as possible. When an orb 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 is broken down into a number of video files which are hosted on YouTube. Click the links below to view the tutorials.
Part 1: Getting started / Creating the Turtle Window / Creating your first turtle / Main Game Loop / Move the turtle
Part 2: Keyboard binding / Turning the turtle
Part 3: Drawing the arena border / Boundary checking for the player
Part 4: Creating a goal (orb) / Basic collision checking
Part 5: Collision checking using a function
Part 6: Moving the goal / Boundary checking for the goal
Part 7: Making multiple goals / Collision checking / Boundary checking
Part 8: Loading a background image / Adding sound (Sorry, Mac only for now.)
Part 9: Keeping track of the score / Drawing the score on the screen
This is still a work in progress - stay tuned for updates. Feel free to comment below or to follow me on Twitter (@tokyoedtech).
Recent blog posts
- Simple Python Game Tutorial Using Classes
- Video Tutorial: Python Spacewar Game
- Video Tutorial: Python To-Do-List (GUI Version)
- Video Tutorial: Simple Space Invaders Clone
- Video Tutorial: Python Functions with Turtle Graphics
- Video Tutorial: Python Guessing Game (GUI Version)
- Global Codeathon Scratch Tutorials
- Video Tutorial: A Simple Python Turtle Graphics Game
- Video Tutorial: Tic-Tac-Toe in Python
- In Favor of Standardization in Ed Tech