My MicroBit Reaction Game

A reaction game: fun! A MicroBit: awesome! A Microbit reaction game: AWESOME AND FUN!

That’s exactly what my game is; awesome and fun!

I have already introduced what a MicroBit is, so let me get into what a reaction game is. It’s honestly pretty self explanatory. In simple terms, reaction game tests how fast you can react to something, which is exactly what my game is, but just on a Microbit!

My finished game!

There were two steps in making Shivani’s Symbol Sprint

1: My code

2: My physical game

Let’s start with the code. Here is a link so you can follow along.

https://makecode.microbit.org/_MY3LCphcCaj5

My code is too long for me to explain every single block, so I will just explain what the main idea is.

So the main idea of my game is for there to be three players. Each player sits in front of a symbol, and the symbols are a heart, a ghost, and a music note. Basically, the MicroBit selects and shows a random symbol of those three. The according player hits their paddle. They must hit it within 3 seconds, or it is considered wrong. Also, if they hit their paddle when it is not their turn, it is also considered wrong. When a player gets it wrong, their symbol is never showed again (this was the hardest part of my code by far). Then, when two of the players have gotten it incorrect, the last player standing is the winner.

I will explain the important key parts of my code.I made a list for the players. The players are 0, 1, and 2. The reason I did this was because if player 1 got eliminated, I couldn’t say, “Pick random number from 0 – 2 without choosing 1.” Therefore, I created a list, and instead of saying “select random number,” I created a function. To make this simple, I said that whenever a player is eliminated, their number in the list is replaced with -1, and -1 is removed from the list. This way, instead of selected a random number from a range, the call is returned with a random number in the list that only has the remaining players.

As I mentioned above, I have a timer in my game. Now, instead of using the running time feature, I decided to make a variable. This way, every second, the variable would increase by one. If the variable, which I called “Time,” reached value 3, the player would be wrong.

My second function was the one that took most of the time for this code. This function is called CheckForWinner. CheckForWinner is used after a player is eliminated. It is called, and checks the list to see if there is only one value remaining. If so, it declares that value the winner.

I know that my code sounds relatively simple, but when I sat down to actually code it, my brain was friend after 2 hours. It’s super hard to put your thoughts into code, even if you know exactly what you want the MicroBit to do.

The next part is my physical product. I used my hot glue gun to do most of this part. Here is a picture of my physical part without the Microbit and alligator clips inside:

I will start from the top.

The Microbit is positioned at the top, above the text and logo for Shivani’s Symbol Sprint.

It is made out of cardboard, hot glue, and tinfoil.

I hot glued my drawing of each symbol onto a small piece of cardboard.

I put player numbers, and you might be able to see player colors. This was for no reason at all…just to make it more colorful!

Because tinfoil conducts electricity, I got each paddle (also made of cardboard), and wrapped some of the top part in tinfoil. There is also a large piece of tinfoil on the bottom for my ground wire. (I will explain this in greater detail in the video).

That’s the main gist of my physical product. Now, time for videos!

Here is a video of my explaining what I just said above (better, of course!):

And here is another one of me playing my game:

I hope you liked this blog post and my game!

If I were to make this better, I would try to incorporate something where a player has 3 lives before they are out. I know exactly how to do this, but I just didn’t have the time.

Overall, I learned a lot from this project. For example, I learned all about functions and lists in my code. Aside from coding aspects, I learned how I should always keep persisting, even if something is not working how I want it to.

I enjoyed this project so much and I hope you enjoyed reading about Shivani’s Symbol Sprint!

PS: If for some reason, you cannot view the videos, email me and I will send you a link! Thank you!

Leave a Reply

Your email address will not be published. Required fields are marked *