Crashy Bird

by vahagn.hakobyan05 in Living > Video Games

3542 Views, 3 Favorites, 0 Comments

Crashy Bird

hqdefault.jpg

That is the game which is very similar to the game flappy bird but it was made for the micro bit. Attention If you just started programming with micro bit that program would be a little difficult for you.

Screen Shot 2018-12-03 at 6.01.54 PM.png
Screen Shot 2018-12-03 at 6.06.01 PM.png

Go to google and type ( https://makecode.microbit.org/# ) now you will see some purple button on which it says New Project, click on it, And you will see the place where we are going to program.

Let's Start Coding!!!

Screen Shot 2018-12-03 at 6.44.14 PM.png

First, you should go to the input and take ( on button A pressed ). After go to the Variables and click ( Make A Variable) call your Variable (bird). After press (Advanced) and find( game ) now click on the game and choose (sprite change X by 1) now put it inside of (on button A pressed) and change the (sprite) to the (bird) after change (x) which is inside of (sprite change X by 1) to (y) and also change (1) to (-1).

Coding!!!

Screen Shot 2018-12-03 at 7.00.21 PM.png

First, you should go to the input and take ( on button A pressed ) and change (A) to (B). After go to the Variables and click ( Make a variable) call your Variable (bird). After press (Advanced) and find( game ) now click on the game and choose (sprite change X by 1) now put it inside of (on button B pressed) and change the (sprite) to the (bird) after change (x) which is inside of (sprite change X by 1) to (y).

Still Coding!!!

Screen Shot 2018-12-03 at 7.52.26 PM.png

Go to basic take (on start). Now go to (Variables) and click (Make a Variable...) call the Variable (index) now again click on (Make a Variable...) call the Variable (Obstacles). Now From (Variables) take ( set bird to 0) change the (bird) to (index) and put it inside of (on start). After go to the (Advanced) and find (Arrays) and take from (Arrays) (set bird to array of 1 2 - +) and change (bird) to (Obstacles) and press the minus button which is on the orange part of the function two times and put it inside of the (on start) under the (set index to 0). Now go to (Variables) take (set Bird to 0) after go to the (Advanced) and find (game). Take from (game) (create sprite at x: 2 y: 2), change (x: 2) to (x: 0) also change (sprite) to (bird). Now put it instead of (0) which is inside of (set Bird to 0) and you will get (set Bird to create sprite at x: 0 y: 2). Now go to the (Advanced) and find (game) from the game take (sprite set x to 0) change (sprite) to (bird) after change (X) to (blink) and after change (0) to (300). You will get (Bird set blink to 300). After put it inside of (on start) under the (set the bird to create sprite at x: 0 y: 2).

Halfway Done!!!

Screen Shot 2018-12-03 at 9.17.52 PM.png

Go to (logic) take boolean (( )and( )) now take (0=0) from (logic) after go to (Advanced) find (Arrays) and take from (Arrays) (Length of array List) now put it in place of first (0) and also change (list) to (Obstacles) now change (=) to (>). After put (Length of array Obstacles>0) in place of first ( ) after that all, you will get ((Length of array Obstacles>0) and ( )). Now go to (Advances) find (game) and take (sprite X) after go to (Advanced) and take (List get value at 0) after change list to (Obstacles) and put it in place of (sprite) after go to (Logic) and take (0=0) and put (Obstacles get value at 0 x) in place of first (0) and you will get (Obstacles get value at 0 x = 0). After put (Obstacles get value at 0 x = 0) in place of second ( ) and you will get ((Length of array Obstacles>0) and (Obstacles get value at 0 x = 0)). After Go to (basic) take the (forever). Now go to the (Loops) take (While true). after put (While true) inside of (forever) after change (true) to ((forever while Length of array Obstacles>0) and (Obstacles get value at 0 x = 0)) . after go to (Advanced) and find (game) from game take (delete sprite) after go to (Arrays) and take (List remove value at 0) after change (list) to ( Obstacles) and you will get (Obstacles remove value at 0) after put (Obstacles remove value at 0) in place of (sprite) which is inside of (delete sprite) and you will get (delete obstacles remove value at 0) after put it inside of ((forever while Length of array Obstacles>0) and (Obstacles get value at 0 x = 0)) and you will get (forever while Length of array Obstacles>0 and Obstacles get value at 0 x = 0 do delete obstacles remove value at 0).

Halfway Done 2!!!

Screen Shot 2018-12-04 at 5.13.05 PM.png

Go to (Loops) take (for element value of list). After go to (variables) press (Make a Variable...) call it (obstacle2 ) and also change (list) to (obstacles). After go to (Advanced) find (game) and from there take (Sprite change x by 1) after change (Sprite) to (obstacle2) after change (1) to (-1). After put ( obstacle2 change x by -1) into the (for element obstacle2 of obstacle) and you will get (for element obstacle2 of obstacle do obstacle change x by -1) put it into (forever) under the (while Length of array Obstacles>0 and Obstacles get value at 0 x = 0 do delete obstacles remove value at 0) and you will get (forever while Length of array Obstacles>0 and Obstacles get value at 0 x = 0 do delete obstacles remove value at 0 for element obstacle2 of obstacle do obstacle change x by -1).

1 More Step Left!!!

Screen Shot 2018-12-04 at 9.40.39 PM.png

Go to (Logic) take (if true then) and (0=0) and put (0=0) in place of (true) you will get (if 0=0 then). Now go to (Math) and take (reminder of 0/1), After go to (Variables) and press(Make a Variable...) and call it (ticks) after go again to (Variables) and take (ticks) and put it in place of (0) and also change (1) to (3) and you will get (remainder of ticks / 3) . Now put (remainder of ticks / 3) in place of first (0) of (if 0=0 then) and then you will get (if remainder of ticks / 3 = 0 then) after put it into (forever) under the (for element obstacle2 of obstacle do obstacle change x by -1) and you will get (forever while Length of array Obstacles>0 and Obstacles get value at 0 x = 0 do delete obstacles remove value at 0 for element obstacle2 of obstacle do obstacle change x by -1 if remainder of ticks / 3 = 0 then). now go to (Variables) and press(Make a Variable...) and call it (emptyObstacly) after take from (Variables) and take (set obstacle to 0) after change (obstacle) to (emptyObstacly) and after go to (Math) and take (pick random 0 to 10) and change (10) to (4) and you will get (pick random 0 to 4) after put it in place of (0) of (set obstacle to 0) and after that you will get (set obstacle to pick random 0 to 4) after put it into (forever) under the (if remainder of ticks / 3 = 0 then) and you will get (forever while Length of array Obstacles>0 and Obstacles get value at 0 x = 0 do delete obstacles remove value at 0 for element obstacle2 of obstacle do obstacle change x by -1 if remainder of ticks / 3 = 0 then set obstacle to pick random 0 to 4) . After go to (Loops) and take (for index from 0 to 4 do) after go to (Variables) and press(Make a Variable...) and call it (index2), after put (index2) in place of (index) from( for index from 0 to 4) and you will get(for index2 from 0 to 4). Now go to (Logic) and take (if true then), after go to from (Logic) and take (0=0) after put (0=0) in place of (true) of (if true then) and you will get (if 0=0 then) after go to (Variables) and take (index2) and put it in place of first (0) of (if 0=0 then) after go to (Variables) and take (emptyObstacly) and put it in place of second(0) of (if index2=0 then) after change(=) to (≠) and you will get (if index2≠emptyObstacly then) after put it into(forever) under (set obstacle to pick random 0 to 4) and you will get (forever while Length of array Obstacles>0 and Obstacles get value at 0 x = 0 do delete obstacles remove value at 0 for element obstacle2 of obstacle do obstacle change x by -1 if remainder of ticks / 3 = 0 then set obstacle to pick random 0 to 4 if index2≠emptyObstacly then). After press (Advanced) and find (Arrays) from (Arrays) take (list and value ( ) to end) change list to (obstacles) after go to (Advances) and find (game) from (game) take (create sprite at x:2 y:2) change (x:2) of (create sprite at x:2 y:2) to (x:4) after go to (Variables) and take (Index2) and put it in place of (2) from (create sprite at x:4 y:2) after that you will get (create sprite at x:4 y:index2). after put (create sprite at x:4 y:index2) in place of ( ) from (obstacles and value ( ) to end) and you will get (obstacles and value create sprite at x:4 y:index2 to end). After put it into(forever) under (if index2≠emptyObstacly then) and you will get (forever while Length of array Obstacles>0 and Obstacles get value at 0 x = 0 do delete obstacles remove value at 0 for element obstacle2 of obstacle do obstacle change x by -1 if remainder of ticks / 3 = 0 then set obstacle to pick random 0 to 4 if index2≠emptyObstacly then obstacles and value create sprite at x:4 y:index2 to end).

Last Step

Microsoft MakeCode for micro bit.png
]].PNG

Go to (loops) take (for element value of list) after go to (Variables) and take ( obstacle3) and (Obstacles) after put (obstacle3) in place of (value) from (for element value of list) after put (obstacles) in place of ( list) from ( for element obstacle3 of list) and you will get (for element obstacle3 of obstacles) after go to (logic) and take ( if true then) and take (< > and < >) after put it in place of (true) from ( if true then ) and you will get (if < > and < > then) go to logic take two of (0=0) and put them in place of (< >) from (if < > and < > then) and you will get (if 0=0 and 0=0 then). Now go to ( Advanced) now to ( game) find ( sprite x) and put all 4 in place of all (0) from (if 0=0 and 0=0 then) and you will get (if sprite x = sprite x and sprite x = sprite x then). Now change first and third (sprite) from (if sprite x = sprite x and sprite x = sprite x then) to (obstacle3) and you will get (if obstacle3 x = sprite x and obstacle3 x = sprite x then). now change third and fourth (x) to (y) after change (sprite) to ( bird) and you will get (if obstacle3 x = bird x and obstacle3 y = bird y then) . Now connect it to (for element obstacle3 of obstacles) and you will get ((for element obstacle3 of obstacles) do (if obstacle3 x = bird x and obstacle3 y = bird y then). now go to (Advanced) now to (game) find (game over) and connect it to ((for element obstacle3 of obstacles) do (if obstacle3 x = bird x and obstacle3 y = bird y then) and you will get ((for element obstacle3 of obstacles) do (if obstacle3 x = bird x and obstacle3 y = bird y then game over). Now go to (Variables) take ( change ticks by 1) and ponnect it to ((for element obstacle3 of obstacles) do (if obstacle3 x = bird x and obstacle3 y = bird y then game over) and you will get ((for element obstacle3 of obstacles) do (if obstacle3 x = bird x and obstacle3 y = bird y then game over) change ticks by 1). Now go to basic and take (pause (ms) 100) and connect it to ((for element obstacle3 of obstacles) do (if obstacle3 x = bird x and obstacle3 y = bird y then game over) change ticks by 1) and you will get ((for element obstacle3 of obstacles) do (if obstacle3 x = bird x and obstacle3 y = bird y then game over) change ticks by 1) pause (ms) 100). And now you should just connect ((for element obstacle3 of obstacles) do (if obstacle3 x = bird x and obstacle3 y = bird y then game over) change ticks by 1) pause (ms) 100) to(forever while Length of array Obstacles>0 and Obstacles get value at 0 x = 0 do delete obstacles remove value at 0 for element obstacle2 of obstacle do obstacle change x by -1 if remainder of ticks / 3 = 0 then set obstacle to pick random 0 to 4 if index2≠emptyObstacly then obstacles and value create sprite at x:4 y:index2 to end) and you will get (forever while Length of array Obstacles>0 and Obstacles get value at 0 x = 0 do delete obstacles remove value at 0 for element obstacle2 of obstacle do obstacle change x by -1 if remainder of ticks / 3 = 0 then set obstacle to pick random 0 to 4 if index2≠emptyObstacly then obstacles and value create sprite at x:4 y:index2 to end for element obstacle3 of obstacles) do (if obstacle3 x = bird x and obstacle3 y = bird y then game over) change ticks by 1) pause (ms) 100).