Spacewar! 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.
I was a child when Space Invaders came out in 1978 and I can still remember playing it at the bar my dad used to frequent, the Conewago Inn. Space Invaders is one of the classic arcade games, along with Pacman, Donkey Kong, Frogger and other games of that era. It is also one of the simplest and a good candidate for a tutorial.
As you learn more about coding, you will find that you will be using and reusing code. Rather than writing the code out again and again and again, you can create functions. The Webopedia defines a function as "a named section of a program that performs a specific task."
Python is a great language and there are a lot of resources on the Internet about how to program Python. One thing I find is that a lot of so-called "beginner" tutorials are actually pretty complicated. In particular, I set out to learn a little bit about GUI programming using Tkinter and found the explanations and examples pretty difficult to follow. So, I decided to create my own to share.
In preparation, I have created a couple of tutorials aimed and the relative beginner. Each project has a video component and an accompanying handout. The video shows in step-by-step fashion how to create each project, while the handout shows the completed scripts.
Project 1: Speed Racer
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.
Tic-Tac-Toe is one of the earliest strategy games that children learn. It has few rules that are easy to grasp which makes it an excellent game to use to learn how to program in Python. In this tutorial, I will walk you through the process of making the game in a step-by-step fashion. This tutorial presupposes that you have at least a passing familiarity with Python concepts such as loops, functions, and lists.
If you haven't read the introduction to this Interactive Fiction project in Python, or Part I, or Part II, now would be a good time to do so! In our last installment, we learned how to use Python classes to create rooms in our virtual world that we could move around. In this installment, we are going to use the same feature, classes, to create items in our game that we can interact with.