Scratch Game
40 mins
+195 XP
What you need:
Chromebook/Laptop/PC or iPad/Tablet

Shark Swim

In this game you need to reach the end of the course before the shark catches you.

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.

    2 - Create the backdrop

    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.
    2. A course with lanes for the diver to swim. In our example we use red lines.
    3. A finish line. In our example we use a green line.


    3 - Add the Diver1 sprite

    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.

    whenclickedsetsizeto40%gotox-173y-138 the x and y should be the start of your course



    4 - Make the diver swim

    To control the diver we are going to point her in the direction of your mouse pointer and then make her continually move 2 steps forward. Doing this will make the diver keep on moving towards wherever you put your mouse.

    Add the following code to the Diver1 sprite, underneath the go to x: 0 y: 0 block.

    whenclickedsetsizeto40%gotox-173y-138 add new code under hereforeverpointtowardsmouse-pointermove2steps



    5 - Add the Shark 2 sprite

    We are going to make the shark appear in a random position and then animate it to make it bite. It will keep repeating this over and over, move to a random position and then bite.

    Add the Shark 2 sprite from the sprite library and give it the following code.

    whenclickedsetsizeto40%hide


    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