Scratch
Beginner
50 mins
Teacher/Student led
+150 XP

Testing and Debugging in Scratch

Students build a working Racing Car game in Scratch step by step, then test it and use a named debugging routine to find and fix problems in their code (LO 1.8).

Teacher Class Feed

Load previous activity

    1 - Start: What We're Building ~5 mins

    You can already drag blocks together in Scratch and start a script with the green flag. Today we're building a Racing Car game — a car you steer around a track with the arrow keys, that even slows down when it drives onto the grass.

    Tip

    We'll build it step by step at our devices: predict first, then build, run, test, and fix anything that doesn't behave. Don't worry if something breaks — that's exactly what today is about.

    2 - Predict Before You Run ~10 mins

    Before anyone clicks the green flag, look at what we're about to build and commit to a prediction. When the program runs and you press the arrow keys, what do you think the car will do? What will you see first on the stage?

    Key point

    Say your prediction to your partner so you can check it later.

    3 - Create a New Scratch Project ~3 mins

    Create a new Scratch project and delete the cat sprite.

    https://scratch.mit.edu

    4 - Add the Car Sprite ~3 mins

    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.

    Tip

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


    5 - Shrink the Car ~3 mins

    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) %

    Tip

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


    123learn · Online learning platform

    Unlock the full learning experience

    You're previewing this lesson. Get full access to this lesson and hundreds more — each one ready to teach, with interactive activities, printable resources and pupil progress tracking built in.

    Hundreds of curriculum-aligned lessons
    Interactive activities in every lesson
    Printable resources & progress tracking
    Copyright Notice
    This lesson is copyright of Coding Ireland 2017 - 2025. 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