How to Create a Microbit Game

by Ajay kannan in Circuits > Microcontrollers

1040 Views, 10 Favorites, 0 Comments

How to Create a Microbit Game

20201119_065747.jpg
Hai pals, In this lesson I am going to teach you how to create a game in tinkercad using the new special component microbit

Supplies

A microbit and your coding skills

Place a Microbit

First you need to select the microbit and place it in the the as you want for creating a game in microbit you only need coding more than design

Start Creating Variables

20201119_065523.jpg
for creating game you need to use variables

Variables;
Variables are a word used for storing values we want , variables are major part this game

In this code I have created variables such as
my position for storing value =2
Asteroid= random from 0 to 4. And
Count and score as 0 on Starting

Create a Key for Moving My Position

20201119_065443.jpg
You need fix how to control the character, so the above picture code means that the position of character need to change when 2nd button in microbit when simulation clicked means move

Clear screen block is used for clearing into normal position again after the button is pressed.

Plotting the Players and Asteroids

20201119_065607.jpg
You need use plot X,y block and along with brightness block also need to create points that needs to be in the game
For the asteroids need to fall continusally so we need to use count variable along with maths block as per our wish.

Create If Block

20201119_065623.jpg
This tells us that if the asteroids fall on the character means the game will over and the game starts once again from first onwards.

Create Else Block Also ;

20201119_065638.jpg
The else block implies us that if the 10 asteroids also didn't fall on the character the game will be win by us

Execution

Screenshot_20201120-082925_Samsung Internet.jpg
The above picture is the result of this coding lesson

I hope everyone understands my project and every one please vote me for Winning the contest
Thank you pals