Migrate docs from the other repo
This commit is contained in:
75
docs/reference/js/lessons/logo-pointer/challenges.md
Normal file
75
docs/reference/js/lessons/logo-pointer/challenges.md
Normal file
@ -0,0 +1,75 @@
|
||||
# magic logo challenges
|
||||
|
||||
These challenges will help you show arrows that point which way the logo is pointing! #docs
|
||||
|
||||
**Challenge 0**
|
||||
|
||||
### @video vimeo/134638098
|
||||
|
||||
This [guided tutorial](/microbit/zysycw) will help you display an arrow pointing the direction the logo is oriented!
|
||||
|
||||
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(() => {
|
||||
}) // ***
|
||||
```
|
||||
|
||||
**Challenge 2**
|
||||
|
||||
### @video vimeo/134639918
|
||||
|
||||
Now we need to display the arrow!
|
||||
|
||||
```
|
||||
input.onLogoUp(() => {
|
||||
images.createImage(`
|
||||
. . # . .
|
||||
. # # # .
|
||||
# # # # #
|
||||
. . # . .
|
||||
. . # . .
|
||||
`).showImage(0)
|
||||
})
|
||||
input.onLogoDown(() => {
|
||||
images.createImage(`
|
||||
. . # . .
|
||||
. . # . .
|
||||
# # # # #
|
||||
. # # # .
|
||||
. . # . .
|
||||
`).showImage(0) // ***
|
||||
})
|
||||
```
|
||||
|
||||
**Challenge 3**
|
||||
|
||||
Let's show a spinning arrow when the micro:bit is shaken. We can do this by adding an on shake condition and showing an animation of the arrow spinning!
|
||||
|
Reference in New Issue
Block a user