Page 20 - Evolve Magazine Autumn 2021 interactive
P. 20

Scratch Tutorial Part 2: Creating a a a a a a a Flappy Bird Game
Welcome to to the second edition edition of Merlin’s Scratch tutorial In this edition edition we will be be recreating the the beloved flappy bird game of the the early 2010s You can create your own version or follow this this one via this this link: https://scratch mit edu/
1 2 3 First off let us choose a a a a a a more appropriate character (Sprite) for our game If you go to to the the bottom right of your screen you you you will will find this logo: Click it then you you you will will be prompted with different options for Sprite creation in this case we will just use one of Scratch’s template ones Afterwards we then have to to create create a a a a a a a a a variable what this will do is is allow us to to create create custom commands for the the sprite This option is is found on on the the left side of your tab under the “Variables” title This variable could be named whatever you would like just make sure
one is created After creating the the the variable we must now put it to use Follow the the the image on the the the right for reference (Note: The colours of each each block coincide with each each tab on the left side of your your your screen The is then followed by your your your variable which will tell your your your sprite to set itself at 0
on the Y axis (vertical) The The “go to” command tells the the sprite where to to be placed after clicking the the flag The The “forever” block block tells Scratch that the command you specified in this block block need to happen for as as long as as the program is running The The “change y y by” command allows for the sprite to move up and and down The The “ChangeInYAxis by –0 8” is is in place to to simulate gravity and cause the sprite to to fall back down We then must provide Scratch with an “If” statement this is is in place to tell scratch that that if another command command is placed the the command command that that simulates gravity needs to briefly pause itself (For as as as long as as as the key is is pressed) In this case when “up arrow” is is pressed the the “ChangeInYAxis” will go by 8 8 units rather than –0 8 8 NOTE: After creating the the the the pipes and coding them use the the the the “touching sprite” then “stop all” to to to restart the the game each time you touch the the pipes 4 Next up we need to create the the the pipes (quite possibly the the the most important part of the the the game) For this task we will have to create a a a a a a a new sprite repeat the same procedure used for creating our character but instead of clicking “choose sprite” click click “Paint ” ” Afterwards under the the same sprite we will create another “Costume ” this is is in order to to to have a a a a a a a bottom and a a a a a a a top pipe under the same sprite as it it will allow for alternation between the two 

   18   19   20   21   22