Also, hide the pipe sprite when the game starts and then show the pipe sprite when starting the clone.Drag & drop the “delete this clone” block as shown below.Let’s delete it once touches the left scratch stage edge.But stuck at the scratch left stage edge. Change the “change x by” value with a negative number this number will be the speed of the pipes (obstacle for the bird) movement.Drag & drop the “change x by” block as shown below.Change the “less than” block value by -240.Drag & drop the “less than”, and the “x position” block as shown below.Drag & drop the “repeat until” block as shown below.Change the pipe sprite’s X value till the pipe sprite touches the left edge of the scratch stage.Also, write a conditional statement to check whether the sprite is reached at the left edge of the scratch stage.In Scratch, we can do this by changing the sprite’s X value with a negative number. Make pipe sprite move from right to left.Drag & drop the “when I start as a clone” block.In Scratch, you can program the clone of any sprite.Drag & drop “when green flag clicked” block on top as shown below.Drag & drop “wait seconds” and “forever” blocks as shown below.Add some delay to the code so that each clone will create every second.Drag & drop the “create a clone of myself” block as shown below.Also, create multiple duplicates of these pipes. Let’s make these pipes and move them from right to left.Step 3: Make the pillars move across the screen If you keep pressing the “Space key” the bird is not overshooting the scratch stage.Drag & drop the “key space pressed” block to the “not” block as shown below.Drag & drop the “not” operator to the “wait until” block as shown below.Drag & drop the “wait until” block as shown below.Write a conditional statement to check whether the “space key” is not pressed.Add a conditional statement to avoid this.But if you keep pressing the space bar key bird keeps going upwards and overshoots the scratch stage area.The bird go up when the space bar key is pressed.To check this condition, again and again, drag & drop the forever loop as shown below.Drag & drop the “set gravity to” block and change its value by 10 you can choose any.Change the gravity variable value to a positive number. Drag & drop the “if-then” and “key space pressed? then” block as shown below.We want the condition for the if statement to be the Sensing block “when space key pressed”. The flappy motion is controlled by the space bar: each time you hit the space bar the bird goes up.Drag & drop the “when green flag clicked” block on top as shown below.Set the bird’s position when the game starts.Drag & drop a forever loop as shown below.Drag & drop the “change gravity by” block and set the value to negative as shown below.From “Variables” drag the “gravity” variable & drop it to the “change y by” block.Drag & drop the “set gravity to” block as shown below and set the number zero.Click on “Variables” and click on “Make a Variable”.Create a variable to keep track of the Y position of the bird.Drag & drop the “change y by” block and change the number.In Scratch, you can move the sprite up & down words by changing the Y value. Change the size of the bird sprite to make sure the bird is small enough to fly through the pillars. The bird sprite was added to the game.Search bird sprite in your downloads directory and click on it.Your sprite is saved in the “Downloads” directory It may differ for you.Click to open the saved folder of bird sprite.Click here to download the bird sprite. Select the color by dragging the “Color”, “Saturation” and “Brightness” sliders as shown below.Click on the “fill” from the paint tool.Let’s make a backdrop, click on “Backdrops”.For that, we will have to choose the right sprite, and the detailed steps on how to do this are outlined below: The first step toward creating the flappy bird game on Scratch is to make the object move. The detailed steps on how to create a flappy bird game on Scratch are explained below
0 Comments
Leave a Reply. |
AuthorWrite something about yourself. No need to be fancy, just an overview. ArchivesCategories |