 Hello everyone. Welcome back to our channel. I hope you all are safe and sound. Most of you must have played games on Xbox using game pads, 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 which you can control using the tip of your fingers. Pre-requisites are a laptop or a computer with good internet, a camera and the latest version of Pictoblox downloaded. Let's begin by adding the human body detection extension. Open Pictoblox. First, select evive as board. To use the extensions of artificial intelligence and machine learning, you need to sign into Pictoblox. Make sure your computer is connected to the internet while working with these extensions. Select human body detection extension and wait for a little while till the models get loaded. First, let's set the stage. Since the battle is going to take place in space, we need a backdrop that looks like outer space. Click on the choose a backdrop button and select the stars backdrop from the library. Time to bring in the characters aka the sprite. Right click on Toby's icon and select delete from the drop-down menu. Now click on the choose a sprite button to open the library. For our game, we need three sprites, the enemy that is the space monsters, a rocket ship and our special monster killing bullets. Add them one by one from the library. Let's first write the script for our rocket ship. Select it from the sprite palette. Now drag and drop the when flag clicked hat block in the scripting area. Adjust the rocket size to 40% of the original size using the set size to block from the looks palette. Then drag and drop the go to XY block from the motion palette. Set X as 0 and Y as minus 140. These coordinates will be a rocket ship's initial position. Now let's add some sound to the game. Add the start sound block from the sound palette. Then click on the sound tab. Click on choose a sound button, then select video game one sound file from the library. Come back to the scripting area by clicking on the code tab and from the drop-down of the start sound block, choose video game one block. Now we need to create two variables. One to monitor the health of our rocket ship and the other to keep track of how many enemies we have killed. Go to the variables palette and create variables health and score. Set the initial value of health to 3 and score to 0 using the set variable to block from the variables palette. Drag and drop the turn on video on stage with 100% transparency block from the human body detection palette. Then drag and drop the forever block from the control palette. Next place the analyze image of hand from the camera block into the forever block. Now we need to make the rocket follow the tip of the index finger. Thus drag and drop the set X to block from the motion palette. Place the position of fingers inside the set X to block. Choose X from the first drop-down, top from the second and index finger from the third drop-down. Next drag and drop the if block. Now place the iski pressed block from the sensing palette and select space from the drop-down. For generating multiple bullets we are going to use the create clone of block. Drag and drop it inside the third if block and select bullet from its drop-down. Finally add a weight block and set the time to 0.1 seconds. No battle game is incomplete without an enemy. So let's bring in the monsters. Click on the monster sprite from the sprite palette. We are going to write two scripts for the monsters. One for creating monster clones and the other for assigning actions to them. First let's write the script for creating the clones. Drag and drop the when flag clicked hat block. Next drag and drop the forever block. Inside the forever block drag and drop the next costume block. Then add the create clone of block to create clones of the monsters sprite. Add the weight block and set the time as 2 seconds. This will make sure that each clone appears 2 seconds after the previous one. Now that the monsters are here it's time to assign actions to them. From the control palette drag and drop the when I start as a clone block. This block will make the script run every time a clone of the monster sprite is created. Now drag and drop the show block from the looks palette. Next drag and drop the go to XY block from the motion palette. Now place the pick random block from the operator's palette into this space next to X and set the range as minus 200 to 200. Set Y as 180. Now drag and drop the repeat until block. Place the greater than operator block and write minus 170 in the first space. Drag and drop the Y position reporter block from the motion palette into the second space. Next drag and drop the change Y by block from the motion palette and write minus 3 in the space. This will make the monster gradually move downwards until either it reaches the bottom of the stage or you shoot them down. Now drag and drop the if block. Place the touching block from the sensing palette into the hexagonal space and select the bullet from the drop down. As soon as the monster is hit by the bullet the score should increase. For that drag and drop the change my variable by block and select the score variable from the drop down and set it to 1. Now let's add a sound for when a bullet hits a monster to make it more lively. Drag and drop the start sound block add the zoop sound from the sound library and select it from the drop down. The monster should disappear once hit by a bullet. Drag and drop the delete this clone block for the same. Now let's write the part which decides what happened if the monster attacks a rocket ship. Duplicate this if block and place the second block below the first one. From the drop down of the touching block in the second if block select the rocket ship. Then select health from the drop down of the change my variable by block. Write minus 1 in the space. Remove the start sound block. This part of the script makes sure that if a monster touches a rocket ship its health will decrease by one. After that the monster will disappear. Now the game should end as soon as the health goes down to zero. For that again duplicate the if block. Replace the touching block with the equal to block from the operator's palette. Next drag and drop the health variable block into the first space and write zero in the second. Drag and drop the wait block and set the time as 0.5 seconds. Now we need to turn the camera off once the game is over. Thus place the turn video on stage with zero person transparency block below it. To stop the game drag and drop the stop block and select all from the menu. At the end of the repeat until block place the delete this clone block. Now let's write the script for our monster killing bullets. First of all select the bullet sprite. Then drag and drop the when I start as a clone block. Place the start sound block and add the laser to sound from the library. Next drag and drop the go to xy block. Drag the off reporter block in the space beside x from the sensing palette. Select x position from the first drop down and rocket ship from the second. Now duplicate this block and drop it into the second space. Select the y position from the first drop down. Now drag and drop the repeat until block. Place the or block into the hexagonal space of the repeat until block. Next place the touching block into the first space of the or block and select edge from the menu. Select monster from the drop down. Now the bullet should move upward until it either hits any of the monsters or reaches the top of the stage. For this drag and drop the change y by block and write 12 in the space. Then drag and drop the delete clone block below the repeat until block. With this the code is complete. You can try to control the game using your nose and share it with us in our picture blocks community on facebook. Also if you like this video give it a thumbs up and don't forget to subscribe to stempedia and follow us on facebook instagram and twitter. Bye bye stay safe.