How to make a gesture-controlled space battle game in PictoBlox and control it using the tip of your fingers.

How to make a gesture-controlled space battle game in PictoBlox and control it using the tip of your fingers.

  • Home
  • Projects
  • Gesture Controlled Space Battle Game in PictoBlox using Human Body Detection

Gesture Controlled Space Battle Game in PictoBlox using Human Body Detection

Gesture COnrtolled Space Battle Game
About This Project

How to make a gesture-controlled space battle game in PictoBlox and control it using the tip of your fingers.

Project Info

Introduction

Most of you must have played games on Xbox, or using gamepads, Joysticks, and whatnot. How about making a game that you can control using your fingertips? Sounds pretty cool, right?

In this video, we will show you how to make a gesture-controlled space battle game in PictoBlox and control it using the tip of your fingers.

Let’s begin!

 

Building Guide

Step 1: Working with PictoBlox

As the title of the tutorial itself suggests, we will be making this project in PictoBlox- a scratch based graphical programming software. Follow these steps and make your own expression recognition machine.

Setting up the Software

As you like to be up-to-date, so does the software. To use the face detection extension of PictoBlox, you need to update PictoBlox to its latest version. You can download it from here.

Adding Up the Extension

Now that we have the latest version, let’s add the Face Recognition.

  1. First, select the board as evive.
  2. Next, click on the add extension button
  3. Once clicked you will be able to see all the extension available,
  4. Select Human Detection ExtensionHuman Body Detection Extension

You will notice new blocks are being added under the same extension

Please remember that this extension requires an Internet connection in order to process images. Also, wait till models get loaded it might take a few moments to load.

What will you need

  1. A pc/laptop with a camera.
  2. PictoBlox.
  3. Internet connection.
  4. A webcam.

Step 2: Writing the Script for the Space Battle Game in PictoBlox

Now, that everything is ready. let’s start writing the script

We have already made a space battle game that you can control with the gamepad of Dabble, a project -making app for Smartphone. As we press keys on the gamepad, it sends data to the control of the games to the computer via evive.

We are going to make the changes to the code of the same game. Download the code from here.

If you wish to get started with programming visit the course here to learn the basics of programming.

Step 3: Making Gesture Controlled Space Battle Game in PictoBlox

Let’s begin by making the changes in the previous script.

Open the downloaded SB3 file directly by clicking on the file. Or open PictoBlox, go to File, then select Open and from the dialog box that appears choose the file that you have downloaded. Once the game is loaded you are ready to make changes.

The Rocketship Script

First, we will begin by editing the script of Rocketship.

  1. Let’s begin removing the extra blocks. Click on Rocketship sprite, remove the first two if blocks inside forever along with its contents. Also, remove is triangle pressed on gamepad block from, the third if block. Now, let’s replace the controls of Dabble by the controls of Hand Gestures.
  2. Select the Human Body Detection palette and add the turn () video on stage with () % transparency block to get your video to control the space battle. Place this block above the forever bock and below the set score to 0 blocks.Gesture Controlled Space Batlle Script
  3. Now to analyze the image from the webcam, add the analyze image for hand in camera block inside the forever block. This block looks for the details on hand location and other details from the live image feed from the camera.Gesture Controlled Space Batlle Script
  4. Next, we need to sync the location of the top of our index finger along the axis with our rocketship to control its movements thus, use a set x to () block from the Motion palate. Place the () position of () of () fingers inside set x to block. Choose from the first drop-down, top from the second and index finger from the third drop-down. This block will provide all the information on the location of all the fingers.Gesture Controlled Space Batlle Script
  5. Then, we need to fire the bullets by pressing the space key on the keyboard.Drag and drop the is space key pressed block from the assessing palette.

The final script of the Rocketship is here: Gesture Controlled Space Batlle Script

The Monster Script

Finally, we need to turn the camera off once the game is over, thus, click on to monster sprite, add the turn Off video on stage with 0% transparency.Gesture Controlled Space Batlle Script

The final script of the monster is here:Gesture Controlled Space Batlle Script

Gesture Controlled Space Batlle Script

The Bullet Script

We are not going to make any changes to the script for bullet sprite.Gesture Controlled Space Batlle Script

With this the script for our Gesture-controlled Space Control is ready.

You can download the script for the game from here.

Step 4: Conclusion

Now play the Rocketship using your fingertip.

Get started with Artificial Intelligence and Machine Learning with the all-new PictoBlox.

Code

DescriptionDownload Code
Gesture controlled Space Battle gameDownload
Share this Project
Share on facebook
Facebook
Share on twitter
Twitter
Share on google
Google+
Share on pinterest
Pinterest
Share on reddit
Reddit
Share on print
Print
Featured Projects
All articles loaded
No more articles to load
Close Menu
×

Cart

Become AI-ready for the FUTURE
Learn Artificial Intelligence and Machine Learning online with us on the FREE webinar!
x