Clear, practical technology insights About · Contact

How to Create a Racing Game in Scratch

Learn how to create a racing game in scratch with clear steps, practical context, and useful troubleshooting guidance.

Author: Kareem Winters11 minutes read
Table of Contents

This updated guide examines How to Create a Racing Game in Scratch and organizes the essential facts, background, and practical takeaways in clear American English.

Part 1

Setting up Your Track

  1. How to Create a Racing Game in Scratch — contextual image 1Open Scratch.Go to https://scratch.mit.edu/ in your computer's web browser.
    1. Scratch is a free programming resource for beginners.
  2. How to Create a Racing Game in Scratch — contextual image 2ClickCreate.It's a tab at the top of the page. Doing so opens the Scratch interface.
  3. How to Create a Racing Game in Scratch — contextual image 3Close the "All Tips" sidebar.Click theXin the list of tips on the right side of the page. While not completely necessary, doing this will make it easier to work in Scratch's interface.
  4. How to Create a Racing Game in Scratch — contextual image 4Enter a title.In the text box with "Untitled" written in it that's in the upper-left corner of the page, enter your game's title (e.g., "My Racing Game").
    1. You may first have to enable Adobe Flash by clicking theAllowprompt or logo.
  5. How to Create a Racing Game in Scratch — contextual image 5Delete the cat-shaped sprite.Right-click the cat in the "Sprites" window that's in the lower-left side of the page, then clickdeletein the resulting drop-down menu.
    1. On a Mac, you can hold downControlwhile clicking the sprite to prompt the drop-down menu.
  6. How to Create a Racing Game in Scratch — contextual image 6Click theBackdropstab.It's at the top of the Scratch page.
  7. How to Create a Racing Game in Scratch — contextual image 7Fill in the background.Before you can draw your track, you'll need to create the background on which the track resides:
    1. Click the paint bucket icon that's below theTicon.
    2. Select your track's background color (e.g., green for grass) at the bottom of the page.
    3. Click the background on the right side of the page.
  8. How to Create a Racing Game in Scratch — contextual image 8Draw your track.You can make your track as uniform or irregular as you like:
    1. Click the brush icon that's at the top of the list of tools.
    2. Select a color for your track (e.g., black) at the bottom of the page.
    3. Increase the brush width by dragging right the slider at the bottom of the page.
    4. Draw the track in a cyclical (not necessarily circular) shape.
  9. How to Create a Racing Game in Scratch — contextual image 9Add a finish/start line.Select a color that's different than the one you used for the background and the track, then decrease the brush's width and draw a line across the place in which you want the race to finish.
    1. This is also the point in front of which your car will start the race.
    2. You may want to use the straight line tool, which resembles a back slash () below the brush icon.

Part 2

Creating a Racer

  1. How to Create a Racing Game in Scratch — contextual image 10Click the "Paint new sprite" icon.It's a brush-shaped line in the upper-right side of the "Sprites" pane, which is in the lower-left side of the page.
  2. How to Create a Racing Game in Scratch — contextual image 11Zoom in.Click the "Zoom in" icon, which resembles a magnifying glass icon with a+in it, at least four times. You should see the largeicon in the middle of the right-hand pane grow larger.
    1. If you didn't do it earlier, you may first have to close the "Tips" sidebar on the right side of the page by clicking theXicon in the sidebar's left-hand corner.
  3. How to Create a Racing Game in Scratch — contextual image 12Draw your racer.Using the brush, draw your racer however you like.
    1. If you're making a car, you might want to use the rectangle tool (the rectangle-shaped icon) to draw the body and then add the car's wheels with the circle tool.
    2. Theicon in the pane represents the center of your racer.
  4. How to Create a Racing Game in Scratch — contextual image 13Draw a crashed racer.Click the brush shaped "Paint new costume" icon below the "New costume" heading, then draw a crashed (or otherwise different) version of your racer. This is the version which will display if your racer touches the grass or any other obstacles you define later.
    1. For example, if your current racer is a happy face, you might make the "crashed" costume a sad face.
  5. How to Create a Racing Game in Scratch — contextual image 14Select your first racer.On the left side of the pane in which you were drawing your racers, click the first one you drew.
  6. How to Create a Racing Game in Scratch — contextual image 15Drag your racer to the starting position in front of the finish line.You'll do this in the left-hand pane. Doing so will ensure that your racer is in the correct starting position when you go to create your script.
    1. The racer will stop once it touches the finish line, so make sure the racer is in front.

Part 3

Creating a Starting Position

  1. How to Create a Racing Game in Scratch — contextual image 16Click theScriptstab.You'll find this at the top of the Scratch page.
  2. How to Create a Racing Game in Scratch — contextual image 17ClickEvents.It's an option just below theScriptstab. Doing so brings up a list of event-based code brackets.
  3. How to Create a Racing Game in Scratch — contextual image 18Add the "when flag clicked" event to the pane.Click and drag the "when [green flag] clicked" icon onto the right-hand pane, then release it there.
  4. How to Create a Racing Game in Scratch — contextual image 19ClickMotion.This blue link is in theScriptssection.
  5. How to Create a Racing Game in Scratch — contextual image 20Add your racer's starting location.This will determine where your racer starts whenever you begin a new game:
    1. Place your mouse cursor over your racer.
    2. Review your racer's x and y coordinates just above the upper-right side of the "Sprite" window.
    3. Drag the "go to x: 16 y: 120" event to fit under the "when flag clicked" event.
    4. Double-click the "16" text box, then type in the x value.
    5. Press theTabkey, then type in the y value.
    6. PressEnter.
  6. How to Create a Racing Game in Scratch — contextual image 21Change the starting position.Drag the "point in direction 90" event from the "Motion" menu to fit under the "go to x y" box. This will ensure that your car is facing the correct direction when the flag is clicked.
  7. How to Create a Racing Game in Scratch — contextual image 22Indicate which costume to use.ClickLooks, then drag "switch costume to costume2" to fit below the starting position, click the "costume2" box, and selectcostume1. This causes your racer to revert to its non-crashed costume when you reset the game.

Part 4

Creating Movement Rules

  1. How to Create a Racing Game in Scratch — contextual image 23Add a movement script.This is the script which your racer will use to move forward:[1]XResearch source
    1. ClickEvents.
    2. Drag the "when flag clicked" event onto the pane, separate of the first "when flag clicked" script.
    3. ClickControl.
    4. Drag the "forever" event to fit below the "when flag clicked" script.
    5. ClickMotion, then drag the "move 10 steps" option to fit in the "forever" slot.
    6. Change the "move 10 steps" variable from "10" to "2", then pressEnter.
  2. How to Create a Racing Game in Scratch — contextual image 24Create controls.You'll use the following script to assign turning controls to your racer:
    1. ClickEvents, then drag the "when space key is pressed" event onto the pane twice. You should have two separate "when space key is pressed" events.
    2. Click the "space" text box on one "when space key is pressed" event, then clickleft arrowin the drop-down menu.
    3. Click the other "when space key is pressed" event's "space" box, then clickright arrowin the drop-down menu.
  3. How to Create a Racing Game in Scratch — contextual image 25Add motions to the controls.This is how you'll use the arrow keys to turn your racer:
    1. ClickMotion.
    2. Drag the "turn [right arrow] 15 degrees" event to fit below the "right arrow" control.
    3. Drag the "turn [left arrow] 15 degrees" event to fit below the "left arrow" control.
  4. How to Create a Racing Game in Scratch — contextual image 26Create an out-of-bounds rule.Using this rule will ensure that, should your racer touch the background color (not the track), it will "crash":
    1. ClickControl, then drag the "if then" option onto a blank space.
    2. ClickSensing, then drag the "touching color" option into the "if then" option's blank space (between the "if" and "then").
    3. Click the current color next to "touching color", then click once the background for your racer's track.
    4. ClickLooks, then drag "switch costume to" to fit in the "if then" gap.
    5. Drag the entire "if then" assembly to fit in the "forever" gap below the "move 2 steps" rule.
    6. ClickControl, then drag the "stop all" option to fit below the "switch costume to" option.
    7. Click "all", then clickthis scriptin the resulting drop-down menu.
  5. How to Create a Racing Game in Scratch — contextual image 27Make a finish line reaction.The following script will create a victory message once your racer crosses the finish line:
    1. ClickControl, then drag the "if then" option onto a blank space.
    2. ClickSensing, then drag the "touching color" option into the "if then" option's blank space (between the "if" and "then").
    3. Click the current color next to "touching color", then click once the finish line.
    4. ClickLooks, then drag the "say hello for 2 secs" option to fit inside the "if then" gap.
    5. Change "hello" to say "You won!", then change the "2" to whatever amount of time you want to use and pressEnter.
    6. Drag the whole "if then" assembly into the "forever" bracket below the other "if" bracket.
  6. How to Create a Racing Game in Scratch — contextual image 28Test your game.Zoom out by clicking the-icon in the bottom-right side of the backdrop area, click the green flag above the left-hand pane, and then use the arrow keys to maneuver around your track. You should be able to reach the finish line without crashing.
    1. If you determine that the track is too narrow or irregular to complete, you can adjust it by clicking the track's icon in the lower-left side of the page, clicking theBackdropstab, and drawing in the areas which need fixing with your track's primary color.

Frequently Asked Questions

What is How to Create a Racing Game in Scratch about?

It provides a structured overview of click, explains the main context, and highlights practical takeaways for readers.

Why does this topic matter?

Understanding the main concepts helps readers evaluate the issue, avoid common mistakes, and make better-informed decisions.

How should readers use this information?

Use the guidance as a practical starting point, confirm details that may have changed, and follow current product, safety, or security recommendations.

Was this article helpful?

Your feedback helps us improve.

Discussion

Reader Comments 0

Sign in with email or Google to join the discussion.