Scratch
Beginner
40 mins
Teacher/Student led
+150 XP

Studio: Shark Swim

Students build a shark chase game in Scratch using movement, sensing and score, following a PRIMM code-along and fixing at least one bug as they go.

Teacher Class Feed

Load previous activity

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

    Illustration for Start: what we're buildingToday you are coding in Scratch. You will build Shark Swim step by step at your device: a diver who swims a course, dodges a shark, and tries to reach the finish.

    You can already move sprites and run a project. Today you will put movement, sensing and a win condition together into one chase game, and you will practise debugging when something does not behave as you expect.

    Before you run anything, think: what do you expect to happen if the diver touches a wall or the shark?

    2 - Introduction ~2 mins

    Welcome to the 'Shark Swim' game creation lesson! In this exciting lesson, you will learn how to create a fun game using Scratch. You will play as a diver who needs to swim through a course without touching the edges or getting caught by a shark. Sounds thrilling, right? Let's dive in and start creating!


    3 - Create a New Scratch Project ~2 mins

    Create a new Scratch project and delete the cat sprite.


    4 - Create the Backdrop ~3 mins

    In the game a diver will swim through a course to try and reach the end without touching the edges or getting caught by the shark.

    Paint a new backdrop with the following:

    1. A blue background (use the square tool ).
    2. A course with lanes for the diver to swim (use the paint brush tool  thickness 20). In our example we use red lines.
    3. A finish line (use the paint brush tool  thickness 20). In our example we use a green line.


    5 - Add the Diver1 Sprite ~3 mins

    Add the Diver1 sprite from the sprite library and then drag it to the start of your swim course.

    Once you've positioned it at the start, add the following code to set it up for the start of the game.

    when green flag clicked set size to (40) % go to x (-173) y (-138) // x and y of the start of your course

    Once you've added the code click on the green flag. Your diver should shrink and stay at the start of the course.

    If you drag your diver away and click the green flag again she will go back to start (this is what the go to x y block does, it makes the sprite go to the coordinates.
    Make sure when your diver is at the start, she isn't touching any of the lines of your course. You may need to change the X and Y coordinates a few times to get it right.




    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