You are on page 1of 17

DIGITAL

LITERACY
SUMMER
NOTE
LET’S DIVE
INTO THE
WORLD OF
CODING AND AI
WITH
PICTOBLOX….
PICTOBLOX

PictoBlox is a
programming software
based on Scratch, where
you can make interactive
games, animations or
program robots and
projects with evive,
Arduino, etc..
Introduction
PictoBlox is a Scratch 3.0-based graphical programming software that is the
ideal companion for setting the first step into the world of programming.

Its user-friendly interface and drag-and-drop functionality eliminate the need


to memorize syntax and rules that is the case in traditional programming
languages and often times scares children and makes them hesitant.

As a result, they only require to focus on the problem at hand and develop
skills such as logical reasoning and problem-solving – the must-have skills in
today’s technology-driven world.

GETTING STARTED
WITH PICTOBLOX
Make Flappy Bird Game Using Human Body Detection
Extension in PictoBlox

I’m sure many of you might be familiar with Flappy Birds – if not the game, then at least the viral Instagram
filter in which you control the bird using your nose. That is exactly what we are going to make in this video.
We’re going to make our version of the flappy bird game using PictoBlox’s Human Body Detection extension in
which we will control the bird using our nose.
STEP 1: Prerequisites
You’ll need the following things to make the make your own logo quiz:
1. A laptop or a computer with a camera
2. The latest version of PictoBlox.
3. A good Internet connection.
STEP 2: Setting Up the Project
Let’s begin by setting up the project.
1. Open PictoBlox
2. Click on the board button and
select evive.

3. Click on the Add extension button.


4. Choose the Human Body Detection Extension and wait for a
little while till the models get loaded.
STEP 3: Setting Up the Stage for the Flappy Bird Game
In this video, we will mainly focus on writing the script to control the bird with the nose. We have already
written the script to set up the stage and project. You can download the script from the link given here

Logo of the flappy bird Sprite


The logo appears every time we start the game by clicking on the green flag. With the start of the game,
the score is set to 0.

The Bird Sprite


This sprite is the hero of our game, we will discuss the scripts into this sprite in the later part of the
project.
The Floor Sprites
The next two sprites are for the floor and the scripts written in them make them move continuously.

Start Button Sprite


Upon clicking the start button, the game starts and the pipe hurdles start moving.

Pipe Hurdles Sprites


The next three are the pipe sprites. On clicking the green flag, these
sprites should be hidden. As soon as the game begins, they should begin
to move in continuously by changing the Y position randomly.
Score Sprite
The next two sprites show the score of the player. As soon as the bird crosses
the hurdle of pipe the score should increase by changing the next costume.
We have used two numbers of sprites to show the score in two-digits. You
may notice that we have used numbers as costumes, you can simply display
the score in the variable too.

Game Over Sprite


The next sprite if the game over sprite that should appear as soon as our bird touches any of the pipe
sprites.

Title Sprite
This is an optional sprite to make the stage look better. You can name the game or add the title sprite
according to your choice.
STEP 4: Writing the Script for the Flappy Bird's Bird
Sprite
Now, let’s come back to our main bird sprite.
Making the Bird Move
Firstly, we will first set up the bird sprite as soon as the game
begins.
1. Thus, drag and drop when I receive () block from the Events
palette and choose begin game from the drop-down.

2. Now to make the bird move forward, place point in direction ()


block from the Motion palette.

3. From the Looks palette, place show block.

4. Also, to bring the bird to the front layer, place go to () layer block
below the show block. Choose front from the drop-down.

5. Now, set the initial position of the bird to x as 0 and y as 0 using the go to
x () y () block from the Motion palette
6. Now, to make the bird look like it is flying, place a forever block from the
Controls palette.

7. Next, place the next costume block from the Looks palette into the forever
block.

8. To make the costume change visible, place the wait () block from the
Controls palette, and write 0.05 into the spa

The final script will look like this:


Controlling the Bird Using Nose
Now, let’s make another script in the bird sprite to control it using our nose whenever we click on the Start button.

1. Drag and drop when I receive () block from Controls palette, choose game
from the drop-down.

2. To turn on the video feed, from the Human Body Detection palette, drag and drop turn on video on
stage with () % transparency block replace 0 with 25.

3. To continuously detect the position of the nose. Drag and drop forever block from the Controls palette.
4. Drag and drop the analyse image for human pose from () block and choose camera from the drop-
down.

5. And set the y position of the bird as the y position of the nose. Drag and drop the set y to () block from
the Looks palette.
6. Into the input, place Y position of () of person () block from the human body detection palette. Choose
nose from the first drop-down and 1 from the second.
The complete script will look like this:
Script when the Bird touched the Pipes
Now, what happens when it touches the sprite. Thus, let’s make a small
script for the same.
1. Duplicate the above hat block and remove all the blocks below it.
2. Place a forever block from the controls palette.
3. Place an if arm from the Controls palette.
4. Place touching color () ? reporter block from the Sensing palette into
the if arm picks the color of the pipe’s border as using the color picker
option.

5.If it touches the pipe, the bird should stop moving a.k.a all the scripts of the bird should stop.
Thus from the controls palette place stop all into the if arm.

With this our script is complete. Click on the green flag and start playing.
STEP 5: Conclusion
With this, you’ve successfully made your
flappy bird project.
Video Tutorial
Make Your Own Flappy Bird Game and Control it With Nose in PictoBlox | AI
and ML

CLICK HERE

Images shown here are property of individual organisation and used here as reference
Source: STEMpedia | One-stop STEM education solution for students & educators (thestempedia.com),
https://thestempedia.com/

You might also like