Introduction: Micro Bit - Snap the Dot Game
In this instructable I will be instructing you on how to make your very own snap the dot game on a micro bit. The purpose of the game is to press the “A” button when the dot is in the middle. This game helps you put your timing and reaction skills to test. Good luck!
Supplies
A micro bit
A computer
A usb cable
Step 1: Step 1
The first step is going to be for you to go to Makecode.microbit.org. Makecode.microbit.org is going to be the website where you are going to make and design your game. When your screen looks like the image above you can proceed to the next step.
Step 2: Step 2
Now you are going to start creating your game! The first thing you are going to want to do is create a variable and name it sprite. The "sprite" is going to be representing the dot.
Step 3: Step 3
The third step is going to be for you to go back to the variable section and drag the "set sprite to" block to the "on start" block.
Step 4: Step 4
Step 4 is going to be for you to go to the game section and select the "create sprite at x: y:" and put where the zero is like the picture above. Now you are going to have a dot in the middle of your micro bit.
Step 5: Step 5
Now you want your “forever block” to look like this. You are going to find the green blocks in the game section, the sprite blocks in the variable section and the blue block in the basic section. This will make your dot go from side to side.
Step 6: Step 6
Now you are going to make your score counter. You want to start by going to the input section and select the “on button A pressed”. When you've done that you want to add that big turquoise block which you will find in the logic section.
Step 7: Step 7
Now you are going to add the “change score by 1” block which you will find in the game section, then you're going to add the “game over” block which you will also find in the game section. Now since you added the “change score by 1” block you will get +1 point when you snap the dot. The game will also now, end when not being able to snap the dot when in the middle.
Step 8: Step 8
Now you're going to start adding some extras. Starting with the sound effects, you're going to go to the music section and add two “start melody, repeating” blocks and put them in the same place as in the image. These blocks are going to play different sounds when either getting a point or when losing. You can choose from a variety of different sounds.
Step 9: Step 9
More extras! This time you are going to go to the input section and first add the “on shake” block as well as the “on button B pressed” block. When you've done that you're going to go to the game section and first take the “pause” block and put into the “on shake” block. After that you're going to go back to the game section and this time take the “resume” block and put into the “on button B pressed” block. Now you are going to be able to pause and resume your game.
Step 10: Step 10
Final step! The final step is going to be to add the background music. You will find the “run in background” block in the controls section and the “start melody” block in the music section. You can choose whichever melody you want to play in the background of your game.