Introduction: How to Make Flappy Birb With Block Editor
Here I shall show you how to make flabby bird for a microbit. This paticular version goes invisible.
- You will need:
- Micro USB cable
- A Computer
Step 1: On Start.
First we need to create 3 variables. index, obstacles and bird.
Then from basic take on start.
Then from variable take set ... to ... and put it to "set index to 0" and put it in on start.
The take the set thing again. Set Obstacles and the take an empty array from the array category.
Then "set obstacles to empty array." Put it in on start
Then take the set thing again and put set bird.
then take a create sprite from game and put it in so it become "set bird to create sprite at x:0 y: 2"
Then from game take ... set ... to ...
Then make " bird set blink to 6969"
That is everything in on start.
Step 2: Making the Bird Fly
From the input section, take two " on button ... pressed"
Then set one to button A pressed and one to button B pressed
Then from the Game section, take two " ... change x by ..."
Set both to change Y and put one in Button A and one in Button B
Change the variable to Bird.
On button A pressed it should change by -1 and on Button B pressed it should change by 1.
Step 3: Generating Obstacles.
From here the steps get hard. Always check back on the picture to make sure you're doing it right.
First we need three new variables. "ticks", "emptyObstacleY" and "index2".
Take an If block from the Logic section. This is where everything will go inside.
Inside Logic, under comparisons , take a "0=0" block.
From Math, take a remainder block.
For the first number, we put in the variable ticks.
The for the second value put a 3.
Then put this newly finished block into the first number value of the 0=0 block turning it into " Remainder of ticks divided by 3 = 0.
Then take this block and put it in the If block instead of true. Then it should say " If remainder of ticks divide by 3 = 0 then"
Now we can put things in the block.
From Variables. Take the set block
Make it " Set emptyObstacleY"
Then from Math, take the pick random block and set the values to "pick random form 0 to 4"
then put this pick random block into your set emptyObstacleY block. Refer to the picture to see if you did it right.
Put this set block under and inside the larger If block.
Now from Loops, take the third block there, For (Variable) from 0 to 4 do.
For the variable, insert "index2"
It should now be, For index2 from 0 to 4 do.
Now put this under and in the larger If block.
Now take another If block and put it in the for block.
Now from the Logic, subsection Comparison, take another if 0=0 block but change it to if 0 does not equal 0.
Replace the first 0 with variable index2
Replace the other variable with emptyObstacleY
Now take this block and put it instead of true.
Now from Arrays, take the add value to end block.
Make the first variable obstacles.
Now in the blank we put a create sprite at x,y block.
X will be 4 and Y will be variable index 2
Now put this Array block in the smaller If block which is in the For block.
Step 4: Making Your Obstacles Move Part 1.
Create a new variable, "obstacle2"
Now from Loops, take the fourth option this time.
Change the first variable to obstacle2 and change the second one to obstacles.
Then from game, take the change x block.
Change the variable to obstacle2
Make it change x
For the number put in -1
now take this game block and put it under and in the for block.
Step 5: Deleting Obstacles
First, from Loops, take the while block.
Then from Logic, subsection Boolean, take the (blank) and (blank) block.
In the first blank, put in another block from the if section, the 0 greater than 0 block.
Replace the first 0 with the length of array block from array.
then insert the variable obstacles into the array block. Keep the second 0
Now on the other side of the and put in from if, the 0 = 0 block.
Keep the second 0
On the first 0, from the game section, take the (blank) x block.
In the blank, from array, put in the (blank) get value at block.
Put in the variable obstacles.
Now put your finished and block into the for block.
Now from game, take the delete block.
From array, put in the remove value at block.
In the remove value at block, set the variable to obstacles and the number to 0.
Step 6: Game Over Screen
First create a new variable. "obstacle3"
Then from Loops, take the for element block.
Set the first variable to obstacle3 and the second to obstacles.
Now in the for block put an if block.
Replace true with an and block.
in the both blanks put in 0=0 blocks
In the first 0=0. Replace them with (blank) x blocks
Set the first to obstacle 3 x and the second to bird x
On the second set of zeros. Put in the same things as before in the same order but replace x with y.
Now from game, take the game over block and put it in the if block.
Step 7: Generating and Moving Obstacles Part 2
Just take from basic a pause block and set the value to 850
also from variables take change ticks by 1.
Step 8: Put It All Together
Now take all the blocks we've made and put them together inside a forever block. Make sure they look exactly like the picture.
Step 9: You're Done
Your game should now be ready to play, test it on the sample micro-bit on the website and make sure you followed all the steps right.