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

Diver Game

In this lesson, students will create an interactive game using Scratch. They will learn to control a diver sprite with their mouse, collect starfish appearing at random positions, and evade a shark that follows them. The lesson covers creating and programming sprites, implementing game logic, and using conditionals to trigger game events.
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 - Welcome to the Diver Game

    Welcome to our exciting coding adventure! Today, we are going to create a fun and interactive game called the 'Diver Game'. In this game, you will control a diver who is swimming in the ocean. Your mission is to collect as many starfish as you can while avoiding a shark that's trying to catch you! Sounds thrilling, right? Let's dive in!

    In this game, we will have 3 characters, also known as sprites:

    1. A diver that you will control with your mouse.
    2. Starfish that will appear in random places for the diver to collect.
    3. A shark that will slowly follow the diver and try to catch him.

    Are you ready to start coding your very own Diver Game? Let's go!


    2 - Create a new Scratch project

    Create a new Scratch project and delete the cat sprite.


    3 - Add the Underwater 1 backdrop

    Add the Underwater 1 backdrop to the project.


    4 - Add and program the Diver1 sprite

    Add the Diver1 sprite from the sprite library. We are going to position the diver at the top middle of the stage area and shrink him to half his size.

    Add the following code to the Diver1 sprite.

    when green flag clicked go to x (0) y (150) set size to (50) %
    Once you've added this new code, click on the green flag and check that it works. The diver should go to the top middle of the stage area (x = 0, y = 150) and shrink to 50% of his original size.



    5 - Make the diver swim

    Next we are going to program the diver to always point towards your mouse pointer and move towards it. This is how you will control where the diver swims to.

    Add the following new code to the Diver1 sprite.

    when green flag clicked go to x (0) y (150) set size to (50) % // add new code under here forever point towards (mouse-pointer v) move (4) steps end
    Once you've added this new code, click on the green flag and check that it works. The diver should point towards and move towards wherever your mouse pointer is.


    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