In this article, we are going to teach you how to program your own
customized version of the popular Flappy Bird game in Scratch.
About game:
It is a game where the player must navigate the bird through a series of pipes.
Lets sketch out Flappy Bird game in Scratch
- Make the bird Fly
- Make the pipes move
- Detect collision with the pipes
- scoring
There are 3 main Sprites to your Flappy Birds game.
Sprite 1 – The Bird
Sprite 2 – The Tube
Sprite 3 – The end line
choose the background for the game
In this tutorial, we choose Blue Sky background as I think it fits with our flappy bird game, but again, feel free to customize and choose your own background.
Make the bird Fly
When the game starts, position the bird to the middle of the screen.
We want to make the bird look like it is flapping, when it is flying. This can be
easily done by switching between different costumes.
The Parrot Sprite that we are using in this game contains two costumes with the wings in
different positions.
Program your bird to move up and down , each time mouse is clicked.
A simple way of giving the bird gravity would be to gradually reduce its
y-coordinate.
If the bird crashes into the ground, then we want to reset the game.
Make the pipes move
Next you have to make the pipes move and arrange them randomly to provide an
obstacle course for Flappy.
Before we start scripting is create the sprite for our obstacles. We need a few different costumes for the obsacles pipe, so we can vary between them.
We want the obstacles to keep coming until the game ends, but instead of
making loads of different sprites, we can make lots of copies of a single sprite.
Now, we need to tell the Obstacle pipe Sprite what to do when it is cloned:
The obstacle needs to start off to the right of the screen, but be centered in
the middle.
We want to select one of the costumes by random.
Now our cloning is set up, we need to make them move across the screen.
However, we want our loop to end when the sprite gets to the opposite edge of
the screen,
To make the loop stop when the clone reaches the left edge of the screen
(where the X-coordinate is -250), we don’t need a clone anymore, it is really important to delete it.
You might want to have a fiddle with the ”wait” and ”move” numbers here
and in the bird sprite, so that the game is as easy or as hard as you wish.
Detect collision with the pipes
To make the game a challenge, the player needs to guide Flappy through the
gaps without touching the pipes or the edges of the screen. Now we’ll add some
blocks to detect if Flappy hits something.
Add scoring
The player should score a point every time Flappy makes it though a pipe.
In this section, we will go through how to keep track of our Score in the game.
To do this, we are going to use something called a ”Variable”, which is just a
way to store information
We want our Score to start at 0 each game, and then it to be increased by one
each time a new obstacle is cloned
I really like your writing style, superb info , thankyou for posting : D.