Scratch Artificial Intelligence
Advanced
60 mins
Teacher/Student led
160 points
What you need:
Chromebook/Laptop/PC or iPad/Tablet
Webcam/camera

Scratch AI Pose Space Game

In this step-by-step lesson, you'll create a Space game using Scratch and Google Teachable Machine. You'll learn to control a spaceship using tilt poses, set up a new Scratch project, add a Rocketship sprite, load a Teachable Machine Model, display pose labels, set confidence thresholds, and make the spaceship move. You'll also learn to label poses, add a Star sprite, and make stars fall. Finally, you'll be challenged to improve your project.
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

    In this lesson, you will create a fun Space game using Scratch and Google Teachable Machine.

    You will learn how to use your Teachable Machine Pose model with tilt poses to control a spaceship.

    If you don't have a Teachable Machine Image model, don't worry! You can use the provided model.


    2 - Setup Scratch and TMPose2Scratch

    Go to https://stretch3.github.io/ and start a new Scratch project and delete the Cat sprite.

    Then, add the TMPose2Scratch extension by clicking on the Extensions button at the bottom left corner of the screen and selecting TMPose2Scratch. This extension allows you to use Google Teachable Machine pose models in your Scratch projects.

    When you add this extension, it will automatically try and use your computer's camera. If necessary, click on 'Allow' to give it permission to use your camera. You should see what the camera is showing in the stage area.



    3 - Add the Rocketship Sprite

    Add the Rocketship sprite to the project and then add the following code to it, to shrink it's size and position a the bottom center of the stage area.

    when green flag clicked set size to (40) % go to x (0) y (-150)

    4 - Load Teachable Machine Model

    Now, let's set up the pose model that our project will use. Add the following new code to your sprite:

    when green flag clicked set size to (40) % go to x (0) y (-150) pose classification model URL [link to your model] :: extension

    Put the link of your pose model into the pose classification model URL block.

    If you don't have your own pose model URL, you can use this one: https://teachablemachine.withgoogle.com/models/R9i0aRHth/

    5 - Display Pose Label

    Click on the 'pose label' block in the TMPose2Scratch extension category to turn it on. This will show you the current pose label being applied to what's being recorded on your webcam.


    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