Scratch
Beginner
50 mins
Teacher/Student led
+150 XP

Conditionals and Events in Scratch

Students build the 'Attack of the Dots' game in Scratch step by step, using conditionals (if), key-press events and the touching-colour blocks, then predict, run, debug and explain their program.

Teacher Class Feed

Load previous activity

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

    Quick recap: last day we used if conditions and events to make things happen on screen — who can give me one event block we used?

    Today you'll build Attack of the Dots in Scratch at your own device. You'll control a spinning disc and match its colour to the dots flying towards it. We'll predict first, then build, run and fix it together.

    2 - Predict Before You Run ~10 mins

    Before anyone clicks the green flag: look at what we are about to build. Commit to a prediction. When the program runs, what will the disc do, and what will you see first on the screen?

    Say your prediction to your partner before you touch any blocks — we'll come back to these later.

    3 - Introduction ~3 mins

    Welcome to the 'Attack of the Dots' game project! In this exciting lesson, you will learn how to create a fun and interactive game using Scratch. You will control a colored disc in the middle of the screen, and your mission is to match the color of the disc with the colored dots that are attacking it. You will learn how to make the disc spin, clone the attacking dots, and detect the color of the dots. Let's get started and have some fun!


    4 - Remix the Starter Project ~3 mins

    We've created a starter project that has some custom sprites for this game.

    Go to the starter project at the below link and click on the Remix button to create a copy of the project.

    https://scratch.mit.edu/projects/281652790/editor/


    5 - Make the Disc Spin ~3 mins

    In this game coloured balls will move towards the disc in the middle. You need to spin the wheel to match the colour of each ball as it hits the wheel. So we'll program the left and right arrow keys on our keyboard to spin the wheel in each direction.

    Add the following code to the 'wheel' sprite:

    when green flag clicked go to x[0] y [0] // place it in the center set size to [30]% // resize the wheel to 30% forever if < key (left arrow v) pressed? > then turn ccw (3) degrees // turn anti clockwise end if < key (right arrow v) pressed? > then turn cw (3) degrees // turn clockwise end end

    Once you've added the code, click the green flag and test if your arrow keys spin the ball!

    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