Balloon Game

Introduction: Balloon Game

For our microbit assignment, my first idea was to find a fun game then make it into a different but similar game which was what I ended up doing. I used the game Crashy Bird and changed and added some things which made it into what it is now, The Balloon Game.

Then Balloon Game is where you control a "balloon" to go down, forwards, and backwards with obstacles you must avoid, the "balloon" always floats back upwards.

Once you are done, the "A button" makes the balloon go down, "B button" makes the balloon go forward, and if you shake the micro bit, it will go backwards.

Teacher Notes

Teachers! Did you use this instructable in your classroom?
Add a Teacher Note to share how you incorporated it into your lesson.

Step 1: On Start

First you need the block "On Start" from the "Basic" category. Then from the "Music" category select "Start Melody _____ Repeating __". In the blanks click on "Power Up" and "Once". Now click on the "Variables" category which you will find the block "Set__ to__", take 3 of those.

In the first one, make a new variable and name it "index" for the second blank just type in "0", so it looks like this "Set index to 0".

For the second one, make a new variable and name it "obstacles" for the second blank go to the "Arrays" category and select "empty array" which is what you will put in the second blank, so that it looks like this "Set obstacles to empty array".

For the third one, make a new variable naming it "bird" and put that in the first blank. For the second blank click on the "Game" category and select "create sprite at x:_y:_". The numbers in the blanks being "x:0 y:2". So that it looks like "Set bird to create sprite at x:0 y:2".

For the last block, go to the category "Game" and select "____set____to__". The blanks should be filled with "bird set blink to 300".

Click on the photo for confirmation.

Step 2: Controlling the Balloon: Downwards

From the category "Input", select the "On button __ pressed" and fill the blank with "A". Then from the

"Game" category select "___ change __ by_", fill the blanks "bird", "y", and "1".

"Bird change y by 1"

Click on the photo for confirmation.

Step 3: Controlling the Balloon: Forwards

From the category "Input", select the "On button __ pressed" and fill the blank with "B". Then from the

"Game" category select "___ change __ by_", fill the blanks "bird", "x", and "1".

"Bird change x by 1"

Click on the photo for confirmation.

Step 4: Controlling the Balloon: Backwards

From the category "Input", select the "On button __ pressed" and fill the blank with "shake". Then from the

"Game" category select "___ change __ by_", fill the blanks "bird", "x", and "-1".

"Bird change x by -1"

Click on the photo for confirmation.

Step 5: The Obstacles: Part 1

From the category "Basic" select "Forever". Now from the "Game" category select "___ change __ by_", fill the blanks "bird", "y", and "-1". From the "Basic" category select "Pause__" and fill the blank with "900".

Then from the category "Loops" select "While true do", now remove "true" with "___and___" from the "Logic" category.

In the first blank, from the "Logic" category select "0>0". From the "Arrays" category select "Length of array ____" and there you fill the blank with the variable "Obstacles" put this block in the first "0" of the "0>0" block so that it looks like this "Length of array obstacles>0".

In the second blank, from the "Logic" category, select "0=0". From the "Game" category, select "sprite x" but replace the "sprite" with "_____get value at__" from the "Arrays" category , fill the blanks with the variable "obstacles" and "0", place this in the first "0" of "0=0". Make sure that the result looks like this "obstacles get value at 0 x > 0".

Now from the "Array" category, select "___ remove value at __", fill the blanks with the variable "obstacle" and "0". Place this block inside "delete sprite" from the "Game" category. Now place this new block in "While length of array obstacles>0 and obstacles get value at 0 x > 0 do delete obstacle remove value at 0"

Now from the "Loops" category, select "For element ___of___do__". For the first two blanks, make a new variable naming it "obstacle2", put that in the first blank, put "obstacles" in the second blank. For the third blank go to the "Game" category and select "___change__by__", fill the blanks with "obstacle2", "x", and "-1".

Look at photo for confirmation.

Step 6: The Obstacles: Part 2

Start by selecting "if___then___" from the "Logic" category. For the first blank select "0=0" from the "Logic" category and replace the first "0" with "remainder of __÷__" from the "Math" category.

In the first blank make a new variable naming it "ticks" and in the second blank put a "4". For the second blank select "set __to__" and fill those blanks with the variable "obstacle" and from the "Math" category select "pick random _to_", fill the blanks with the numbers "0" and "4".

From the "Loops" category add the block "for___from 0 to__do____". The first blank should have the variable "index" in it. The second blank should be "4". Then the third blank should have the block "if__then____" and for the first blank of that you need "0=0" but you must replace both the zeros. The first zero should be replaced with the variable "obstacles' and the second zero should be replaced with a new variable called "empty obstacle". Then for the second blank select "___add value___to end", the first blank of that block should be "obstacle2" variable, and the second blank should be "create sprite at x:__y:__", the blanks being "4" and the variable "obstacles".

Now take a new block from the "Loops" category called "for element___of___do____", in the first two blanks place the variables "obstacle" and "obstacles". In the third blank you will need the block "if____then___" from the "Logic" category. For the first blank of this block you will need "____and____" from the "Logic" category, and in both these blanks you will place the "0=0" block from the "Logic" category.

Now in the first "0=0", replace both the zeros with "sprite x" from the "Game" category. For the first "sprite x", replace the "sprite" with the variable "obstacle". For the second "sprite x" replace the "sprite" with the variable "bird".

For the second "0=0" replace both zeros with "sprite y" from the "Game" category. Then replace the first "sprite" with "obstacle" and replace the second "sprite" with "bird".

The result should look like this "if obstacle x = bird x and obstacle y = bird y"

Now for the second blank of "if obstacle x = bird x and obstacle y = bird y then___", from the "Music" category select "start melody___repeating___". Fill those blanks with "wawawawaa" and "once", you must also add "game over" from the "Game" category.

Now under all that select "change__by_", fill those in with "ticks" and "1", and select "pause (ms) 100" from the "Basic" category.

Look at photo for confirmation.

Step 7: Put Together Part 1 and 2

Now you need to drag Part 2 to go underneath Part 1 and make sure they are both inside the "Forever" block.

Look at photo for confirmation.

Be the First to Share

    Recommendations

    • Magnets Challenge

      Magnets Challenge
    • Makey Makey Contest

      Makey Makey Contest
    • Instrument Contest

      Instrument Contest

    Discussions

    0
    audreyobscura
    audreyobscura

    6 weeks ago

    Thanks for sharing your class project!