Scratch
Beginner
60 mins
Teacher/Student led
160 points
What you need:
Chromebook/Laptop/PC or iPad/Tablet

Racing Car

Embark on an exciting journey to create your own racing car game using Scratch. You'll learn to create a new project, add and modify sprites, draw a racing track, and program your car to move around the track. You'll also learn to create variables and control the speed of your car. Happy coding!
Learning Goals Learning Outcomes Teacher Notes Lesson Files

Live Class Feed

This is a live feed of the latest activity by your students on this lesson. It will update in real-time as they work on the lesson.
Load previous activity

    1 - Create a new Scratch project

    Create a new Scratch project and delete the cat sprite.

    https://scratch.mit.edu

    2 - Add the car sprite

    Included with this step is a red car picture that we're going to upload into our Scratch project. First download the picture file onto your computer and then upload it into your project.

    To download a picture to your computer, right click on the picture and then click on 'Save image as...'


    3 - Shrink the car

    As the car sprite is very large, we'll need to shrink it so that it has room to move around. We're going to shrink it to 10% of it's original size. Add the following code to the car sprite.

    when green flag clicked set size to (10) %

    Click on the green flag and the car will shrink to a smaller size.


    4 - Draw a racing track

    We're going to use the backdrop editor to draw a racing track. To open the backdrop editor do the following:

    1. Click on the stage backdrop in the bottom right. A blue box should appear around it.
    2. Click on the backdrops tab in the top left. You should now see the backdrop editor.

    Next we're going to draw a race track. First we will colour the background green and then we will draw a black track. Follow these steps:

    1. Click the Convert to Bitmap button.
    2. Select the colour green in the Fill tool.
    3. Click on the Paint Bucket tool.
    4. Click on the backdrop to change it's colour to green.
    5. Click on the Convert to Vector button.
    6. Click on the Brush tool.
    7. Select the colour black in the Fill tool.
    8. Set the thickness of the brush to be 90.
    9. Draw a simple loop track by holding down the left button, moving your mouse and then releasing the left button.


    5 - Place your car on the track

    Drag your car in the stage area and place it on your track.

    We want the car to always start in this position when we click the green flag so add the following code to the car sprite underneath the set size to 10 % block.

    when green flag clicked set size to (10) % // add new blocks under here go to x:(0) y:(0)// these will be prefilled with the current location of the car point in direction (90)// point to the right

    Note: When you use a go to x: 0 y: 0 block the x and y values will be prefilled with the current position of your car. This is why you should position your car on the track first and then drag in this block.


    Unlock the Full Learning Experience

    Get ready to embark on an incredible learning journey! Get access to this lesson and hundreds more in our Digital Skills Curriculum.

    Copyright Notice
    This lesson is copyright of Coding Ireland. Unauthorised use, copying or distribution is not allowed.

    Scratch is developed by the Lifelong Kindergarten Group at the MIT Media Lab. It is available for free at https://scratch.mit.edu
    ๐Ÿช Our website uses cookies to make your browsing experience better. By using our website you agree to our use of cookies. Learn more