pxt-calliope/docs/reference/js/lessons/landslide/challenges.md

78 lines
1.3 KiB
Markdown
Raw Normal View History

2016-03-26 00:47:20 +01:00
# landslide challenges
2016-04-02 01:22:47 +02:00
Coding challenges for the landslide tutorial.
2016-03-26 00:47:20 +01:00
### ~avatar avatar fail
Don't drop me on the ground without protection! I'm very fragile. Ouch!
### ~
## Before we get started
Complete the following guided tutorial:
2016-04-13 17:27:45 +02:00
* [tutorial](/lessons/landslide/tutorial)
2016-03-26 00:47:20 +01:00
At the end of the tutorial, click `keep editing`. Your code should look like this:
```
input.onFall(() => {
images.createImage(`
. . # . .
. . # . .
. . # . .
. . . . .
. . # . .
`).showImage(0) // ***
})
```
### Challenge 1
Add a pause within `input->on fall` after displaying `!`. This will allow us to display another image in the next challenge.
```
input.onFall(() => {
images.createImage(`
. . # . .
. . # . .
. . # . .
. . . . .
. . # . .
`).showImage(0)
basic.pause(2000) // ***
})
```
### Challenge 2
Create and show an `X` image after the pause from Challenge 1.
```
input.onFall(() => {
images.createImage(`
. . # . .
. . # . .
. . # . .
. . . . .
. . # . .
`).showImage(0)
basic.pause(2000)
images.createImage(`
# . . . #
. # . # .
. . # . .
. # . # .
# . . . #
`).showImage(0) // ***
})
```
* `Run` the program to see if it works as expected.
### Challenge 3
Now let's display a third image when the micro:bit falls! First, add `basic->pause(2000)` followed by another image of your choice. Be creative!