pxt-calliope/docs/lessons/guess-the-number/challenges.md
Sam El-Husseini e3975e65e5 pxt-microbit Accessibility PR ()
* Accessibility changes
2017-09-07 13:42:08 -07:00

818 B

guess the number challenges

Coding challenges for the guess the number tutorial.

Before we get started

Complete the following guided tutorial, and your code should look like this:

input.onButtonPressed(Button.A, () => {
    let x = Math.random(9)
    basic.showNumber(x)
})

Challenge 1

When button B is pressed, we want to clear the screen. This will make it so users can play your game over and over again! Add an event handler to handle this case.

input.onButtonPressed(Button.A, () => {
    let x = Math.random(9)
    basic.showNumber(x)
})
input.onButtonPressed(Button.B, () => {
    basic.clearScreen()
})

Challenge 2

Show an animation when you clear the screen! Choose what animation makes most sense to you. Be creative!