pxt-calliope/docs/lessons/screen-wipe/challenges.md

163 lines
2.3 KiB
Markdown
Raw Normal View History

2016-03-26 00:47:20 +01:00
# screen wipe blocks challenges
Coding challenges for screen wipe.
## Before we get started
2016-04-13 17:27:45 +02:00
Complete the [screen wipe](/lessons/screen-wipe) activity and your code will look like this:
2016-03-26 00:47:20 +01:00
```blocks
basic.showLeds(`
# # # # #
# # # # #
. . . . .
. . . . .
. . . . .
`)
basic.showLeds(`
# # # # #
# # # # #
# # # # #
# # # # #
. . . . .
`)
basic.showLeds(`
. . . . .
. . . . .
# # # # #
# # # # #
. . . . .
`)
basic.showLeds(`
. . . . .
. . . . .
. . . . .
# # # # #
# # # # #
`)
input.onButtonPressed(Button.A, () => {
basic.clearScreen()
})
```
2016-05-06 18:28:26 +02:00
### Challenge 1
2016-03-26 00:47:20 +01:00
Create an event handler for Button B.
```blocks
basic.showLeds(`
# # # # #
# # # # #
. . . . .
. . . . .
. . . . .
`)
basic.showLeds(`
# # # # #
# # # # #
# # # # #
# # # # #
. . . . .
`)
basic.showLeds(`
. . . . .
. . . . .
# # # # #
# # # # #
. . . . .
`)
basic.showLeds(`
. . . . .
. . . . .
. . . . .
# # # # #
# # # # #
`)
input.onButtonPressed(Button.A, () => {
basic.clearScreen()
})
input.onButtonPressed(Button.B, () => {
})
```
2016-05-06 18:28:26 +02:00
### Challenge 2
2016-03-26 00:47:20 +01:00
2016-05-27 00:24:10 +02:00
2016-03-26 00:47:20 +01:00
Replay the animation when the "B" button is pressed placing the `show LEDs` block on the canvas.
```blocks
basic.showLeds(`
# # # # #
# # # # #
. . . . .
. . . . .
. . . . .
`)
basic.showLeds(`
# # # # #
# # # # #
# # # # #
# # # # #
. . . . .
`)
basic.showLeds(`
. . . . .
. . . . .
# # # # #
# # # # #
. . . . .
`)
basic.showLeds(`
. . . . .
. . . . .
. . . . .
# # # # #
# # # # #
`)
input.onButtonPressed(Button.A, () => {
basic.clearScreen()
})
input.onButtonPressed(Button.B, () => {
basic.showLeds(`
# # # # #
# # # # #
. . . . .
. . . . .
. . . . .
`)
basic.showLeds(`
# # # # #
# # # # #
# # # # #
# # # # #
. . . . .
`)
basic.showLeds(`
. . . . .
. . . . .
# # # # #
# # # # #
. . . . .
`)
basic.showLeds(`
. . . . .
. . . . .
. . . . .
# # # # #
# # # # #
`)
})
```
2016-05-06 18:28:26 +02:00
### Challenge 3
2016-03-26 00:47:20 +01:00
Show an animation that scrolls back up when you press button "B".
* tap the *run* button to view your final product!