Scratch Walkthrough –Racing Car

Lesson 1 - How to make a car and track.

Click onto the "stage", shown below and click onto Edit to draw your track. Make sure you put a finish line in!

To Edit your car, click onto your sprite, shown below, and click onto Edit(to change yours) or Import (to get a new one).

Lesson 2 - How to make the car only move on the track

Firstly, edit your sprite, as shown in Lesson 1. You need to draw a dot onto the front of the Sprite. Then click "OK"

Secondly you need to create the code to make the car move, when it is touching the colour of the track. This is shown below.

Now we need to make the car turn, to do this use code SIMILAR to the code below.

We now have a car that only moves on the track!

Lesson 3 - Creating a laps counter

To create a laps counter, we first need to create a variable. This is done by clicking onto the "variable section" and clicking onto "Make a variable". When you have done this, a popup box will appear where you name your variable. Let’s call ours "laps".

Then you click OK.

Next, we need to make sure the lap counter increases when we touch the finish line. This is done by using the code below to "change laps by 1" whenever the colour of our dot touches the colour of the finish line.

Finally we need to make sure that when we start the game, we start on "0" laps. This is done by using a simple bit of code, to set the laps to "0" when the green flag is clicked.

We now have a working score counter! However if the score increases by more than 1 lap each time, we need to add in a "wait" to our original code to fix this. This is shown below.

Lesson 4 - Adding new levels to the game.

Firstly we need to create our new levels; we do this by clicking on our stage, then clicking copy and editing the newly created background by using the edit tool.

The next thing we need to do is to make the code, so that the background changes when we hit a certain number of laps. This code is shown below.

Finally we need to set our code, so that when we start the game, our first level loads. This is shown below.

We now have a fully working Scratch Racing Game! Well done!