Introduction: Programming the Racing Game in Scratch

This tutorial will show you how to program a racing game inside of MIT's Scratch.

Step 1: First....

1) Go to http://www.scratch.mit.edu
2) Search Noah1194 in the search field
3) Click on the racing game and download it.

Step 2: Starting the Game.

1) You will notice that in the car sprite there are a bunch of scripts.
2) Take a look at the first one at the top on the left that starts with a "when flag is clicked"
3) The program says: when the flag is clicked set the variable "timer" to 30, make the car in the right costume, and make it go to the right place on the track.

Step 3: Moving the Car.

1) Now look at the scripts that start with "when key is pressed".
2) These four commands are the ones that make the car move.
3) They are pretty simple. They just say point in either the right, left, up, or down direction and move that way.

Step 4: Touching Color Commands.

1) If you scroll down you will see a lot of commands that have the "touching color" commands in it.
2) What those say is, if the car is touching color.... then either go to the next level, or go to a place on the track, or set size, ect.

Step 5: Timer Variable.

1) In the car sprite look for a script that has the variable "timer" in it.
2) You will notice that there are commands inside of a "forever" block.
3) What that program says is, when the flag is clicked, wait a second, then decrease the timer by -1. Then in a "if" block it says, if the timer reaches 0, then broadcast game over and set timer to 0.

Step 6: Changing Backgrounds

1) Go into the stage sprite and you will see short scripts that start with "when I receive".
2) All those commands are telling the stage sprite to switch backgrounds when each one is received.

Step 7: Hiding and Showing Sprites.

1) Under other sprites, such as the arrows, or the start and finish sprites, are commands that tell it to hind and show.
2) When a sprite is not needed in a track or should come up at a particular time you put the hide command in. If you want it to come up at a particular time you put a hide then wait, then a show.