How would you like to make your very own video game? Sound impossible? Well it isn't! This science fair project will walk you through the steps of creating a simple video game. And once you've done that, you can take what you've learned and use it to come up with a game idea of your own, modify the game you've already created, or just sit back and enjoy playing your creation from this science fair project.
Video games are basically made up of a set of instructions, called a program, which tells the computer (or game console) what to do. The instructions include information like what characters, or other art, to display on the screen; what should happen when the player presses different buttons; and when specific sounds or songs should be played. If you were giving a set of instructions to a person, you'd probably write them down using a language that the person understood.
For example, the Experimental Procedure for this science fair project is a list of instructions, written in English, telling you how to do this project. Similarly, programmers (people who write programs) use special languages to write computer instructions. These programming languages are specifically built to take advantage of how computers process information. Just as there are many different human languages, there are also many different programming languages. Different programming languages have different advantages and disadvantages—some are good for telling computers how to display images, while others are better at allowing the computer to do mathematical calculations quickly. Programmers choose which programming language to use based on the tasks they want the computer to perform, and which languages the programmer knows.
In this science fair project you'll create a video game using an easy-to-use programming language called ScratchTM. Scratch was created by researchers at the Massachusetts Institute of Technology (MIT) and is specifically made for beginning programmers—so even if you've never programmed anything before, you'll be able to use Scratch! Scratch uses blocks (simple instructions), which you can hook together, by dragging and dropping with your mouse, to make longer and more complex instructions. Each set of blocks is called a script. In the Scratch program shown in Figure 1, above, there are two scripts—one that instructs the computer to make the cat "walk 10 steps when the player hits the right arrow key" and another script that instructs the computer to "play a meow sound when the player hits the space bar."
The game you will create in this science fair project is a game of chase between a cat and a dog. The cat will be controlled by the player, and the dog will be controlled by the computer. The game will end when the dog catches the cat. Ready to program? Let's get started! The references in the Bibliography and in the Experimental Procedure, below, will teach you all the programming skills you need to know to make this game. Once you've made the game, you may surprise yourself with all the fun additions and variations you can add to the game using your new programming skills!
The instructions below divide the process of programming this video game into several manageable pieces. For each piece, you'll be given programming objectives and told which blocks are necessary to create the program. It'll be your task in this science fair project to figure out how the blocks should be hooked together to achieve the programming goals. Once the game is running, you'll make final changes to the game to improve the gameplay experience.
Runs script below it when green flag is clicked.