Scratch Game
Beginner
60 mins
Teacher/Student led
215 points
What you need:
Chromebook/Laptop/PC or iPad/Tablet

Shark Swim

In this lesson, students will learn how to create an engaging 'Shark Swim' game using Scratch. They will gain skills in controlling a sprite with the mouse, creating and animating sprites, detecting collisions, and establishing a simple game loop. The lesson is interactive and hands-on, providing a fun introduction to game development.
Learning Goals Learning Outcomes Teacher Notes 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 - Introduction

    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!


    2 - Create a new Scratch project

    Create a new Scratch project and delete the cat sprite.


    3 - 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 (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.


    4 - 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.

    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.




    5 - 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 y block.

    when green flag clicked set size to (40) % go to x (-173) y (-138) // add new code under here forever point towards (mouse-pointer v) move (2) steps end

    Click on the green flag and your diver should continually point and move towards your mouse pointer.


    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