How to Create a Microbit Game
by Ajay kannan in Circuits > Microcontrollers
1093 Views, 10 Favorites, 0 Comments
How to Create a Microbit Game
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
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
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
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.
Clear screen block is used for clearing into normal position again after the button is pressed.
Plotting the Players and Asteroids
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.
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
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 ;
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
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
I hope everyone understands my project and every one please vote me for Winning the contest
Thank you pals