Scratch Game
Intermediate
60 mins
Teacher/Student led
+115 XP
What you need:
Chromebook/Laptop/PC or iPad/Tablet

Attack of the Dots

Get ready to create an exciting game in Scratch! You'll control a spinning disc to match colours with attacking dots. Learn to program the disc's movement, clone dots, and detect colours as you build this interactive project.
Learning Goals Learning Outcomes Curriculum Mapping Teacher Notes Lesson Files

Teacher Class Feed

Load previous activity

    1 - Introduction

    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!


    2 - Remix the starter project

    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/


    3 - Make the disc spin

    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!

    4 - Clone the ball

    In the game, the balls should appear every few seconds, in a random position and start moving towards the wheel.

    Add the following code to the green ball called 'Sprite1':

    when green flag clicked hide forever wait (pick random (4) to (8)) seconds // wait a random number of seconds create clone of (myself v) // create the clone end when I start as a clone go to (random position v) // start in a random position point towards (wheel v) // point in the direction of the wheel show

    Click on the green flag and the green balls should start appearing in random places.

    5 - Not too close!

    We don't want the balls appearing too close to the wheel as it won't give us much time to react. So to prevent this add the following code to 'Sprite1' which detects where the ball is when it's cloned and deletes it if it's too close.

    when I start as a clone go to (random position v) point towards (wheel v) show // add new code under here if < ( distance to (wheel v)) < (100) > then delete this clone end

    Click on the green flag and check that no balls are being created too close to the wheel.

    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