0% found this document useful (0 votes)
626 views2 pages

CL5 - CH6 - AI Space Battle Game

This activity sheet describes how to build a gesture-controlled space battle game using artificial intelligence in PictoBlox. Students will modify an existing rocketship game from a previous session to be controlled by hand gestures detected through a webcam, rather than arrow keys. The script is changed to detect if a hand is present using computer vision, and if so, set the rocketship's x and y position based on the position of the tip of the index finger. This allows the rocketship to be maneuvered in real-time through hand gestures detected by the webcam.

Uploaded by

sdsdfs
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
626 views2 pages

CL5 - CH6 - AI Space Battle Game

This activity sheet describes how to build a gesture-controlled space battle game using artificial intelligence in PictoBlox. Students will modify an existing rocketship game from a previous session to be controlled by hand gestures detected through a webcam, rather than arrow keys. The script is changed to detect if a hand is present using computer vision, and if so, set the rocketship's x and y position based on the position of the tip of the index finger. This allows the rocketship to be maneuvered in real-time through hand gestures detected by the webcam.

Uploaded by

sdsdfs
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 2

ACTIVITY SHEET

Class 5 Activity Sheets

SESSION 6

AI Space Battle Game

In this activity, we will make a gesture-controlled space battle game using Artificial Intelligence, in
PictoBlox and control the Rocketship game made in session 4 using the tip of our fingers.

This activity sheet belongs to _____________________________________________________________

MATERIALS REQUIRED
□ Computer / Tab / Laptop with PictoBlox Installed.

STEP-BY-STEP
1. Open the PictoBlox file “Space Battle Game”, we made in the session 4.
2. Now, all the scripts will remain the same except the script of the Rocketship. We will modify the script
of Rocketship, to change our controls. Let us start!
3. Delete the if blocks for left and right arrow keys from the main script.

Old Script New Script

Remove
these 2
if blocks

Powered by STEMpedia www.ai.thestempedia.com 13


Class 5 Activity Sheets

4. Add the Human Body Detection Extension to your palette, like we did in the previous session.
5. Add a turn-on video on stage with a 0% transparency block from the Human Body Detection palette
below the when green flag clicked block. Make the transparency 50%.
6. Now, as we need the details of our hand in real-time, we will be using analyse image for hand from
camera block from the Human Body Detection palette inside the forever block.
7. Next, we need to check whether our hand is detected or not. Thus, place an if () then block from
the Controls palette, below the if () then block
already present.
8. Add is hand detected block inside the if () then
block.
9. Add set x to () block from the Motion palette
within the if () then block, we just added.
10. Next, place the x position of () block from
the Human Body Detection palette into the set
x to () block, and select top of index finger from
the dropdown.
11. Add set y to () block and set the value inside it
to -140.
12. Hurray… Our game is finally ready! Click the
green flag and play!

SAVING THE PROGRAM


Save the project file as AI Space Battle Game. Check page 3 if you missed how to save the project.

Powered by STEMpedia www.ai.thestempedia.com 14

You might also like