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

Keepy Ups

In this Scratch game we will use the video sensing blocks to interact and play a game where we have to keep multiple footballs in the air!

To do this lesson your computer must have a camera on it.

Teacher Notes

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.

    https://scratch.mit.edu

    2 - Add the Basketball sprite

    Add the Basketball sprite from the sprite library.


    3 - Add the Video Sensing extension

    We're going to use the camera that's in your computer to take a video and put you in the game!

    Add the Video Sensing Extension so that we can use the Video Sensing blocks.

    Then add the following code to Basketball sprite, to turn on the camera on your computer.

    whenclickedturnvideoon

    You may see a pop up asking you to allow Scratch to use your camera. Click on the Allow button otherwise Scratch will not be able to use your camera.


    4 - Create a custom 'go to top' block

    We're going to create a custom block of our own that we'll use to move the basketball up to a random place at the top of the screen.

    Create a custom block called 'go to top' and add the following code to the define  go to top block to make the basketball go to a random place at the top of the stage area.

    definegototopgotoxpickrandom-250to250y250whenclickedturnvideoon add it under heregototop

    And then add the go to top block underneath the when clicked block.

    Test that it works by clicking the green flag several times. The basketball should go to different random places at the top of the stage area.


    5 - Make the ball fall

    Now we will program the ball to fall down by changing it's y position. The y position sets where the sprite is on the Y axis (up and down). 

    Add the following code underneath the go to top block.

    definegototopgotoxpickrandom-250to250y250whenclickedturnvideoongototop add it under hereforeverchangeyby-5


    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