truth or dare tutorial
Rebuild the game!
The blocks have been shuffled! Put them back together so that…
- an up arrow is displayed when the micro:bit is powered on.
- on button
A
is pressed,- randomly display “TRUTH” or “DARE” on the screen
- show the up arrow again.
basic.showLeds(`
. . # . .
. # # # .
# # # # #
. . # . .
. . # . .
`)
input.onButtonPressed(Button.A, () => {
let random = randint(0, 2)
if (random == 0) {
basic.showString("TRUTH")
} else {
basic.showString("DARE")
}
basic.showLeds(`
. . # . .
. # # # .
# # # # #
. . # . .
. . # . .
`)
})
Hints and tips
Cut out these documentation cards to help you!
basic.showLeds(`
. . # . .
. # # # .
# . # . #
. . # . .
. . # . .
`);
randint(0, 2);
basic.showString("TRUTH");
if (true) {} else {}
"TRUTH";
0;
input.onButtonPressed(Button.A, () => {});