pxt-calliope/olddocs/js/lessons/logo-pointer/challenges.md

72 lines
1.2 KiB
Markdown
Raw Normal View History

2016-03-26 00:47:20 +01:00
# magic logo challenges
These challenges will help you show arrows that point which way the logo is pointing! #docs
2016-05-27 04:33:26 +02:00
## Challenge 0
2016-03-26 00:47:20 +01:00
2016-04-13 17:27:45 +02:00
This [guided tutorial](/zysycw) will help you display an arrow pointing the direction the logo is oriented!
2016-03-26 00:47:20 +01:00
Let's display and upward pointing arrow when the logo is up!
```
input.onLogoUp(() => {
images.createImage(`
. . # . .
. # # # .
# # # # #
. . # . .
. . # . .
`).showImage(0)
})
```
**Challenge 1**
How about when the logo is down? We should display the arrow pointing downward!
Let's start by adding a condition for if the logo is down.
```
input.onLogoUp(() => {
images.createImage(`
. . # . .
. # # # .
# # # # #
. . # . .
. . # . .
`).showImage(0)
})
input.onLogoDown(() => {
}) // ***
```
2016-05-27 04:33:26 +02:00
## Challenge 2
2016-03-26 00:47:20 +01:00
Now we need to display the arrow!
```
input.onLogoUp(() => {
images.createImage(`
. . # . .
. # # # .
# # # # #
. . # . .
. . # . .
`).showImage(0)
})
input.onLogoDown(() => {
images.createImage(`
. . # . .
. . # . .
# # # # #
. # # # .
. . # . .
`).showImage(0) // ***
})
```
**Challenge 3**
2016-11-02 01:44:37 +01:00
Let's show a spinning arrow when the @boardname@ is shaken. We can do this by adding an on shake condition and showing an animation of the arrow spinning!
2016-03-26 00:47:20 +01:00