Add 'paper' step info to RPS tutorial (#1810)
* add showLeds for paper * fix blocks for step 6 * no blocks in shake demo
This commit is contained in:
parent
32b49cf8b1
commit
4f22abf4c9
@ -31,7 +31,6 @@ let hand = 0;
|
|||||||
input.onGesture(Gesture.Shake, () => {
|
input.onGesture(Gesture.Shake, () => {
|
||||||
hand = Math.randomRange(1, 3)
|
hand = Math.randomRange(1, 3)
|
||||||
})
|
})
|
||||||
|
|
||||||
```
|
```
|
||||||
|
|
||||||
In a later step, each of the possible numbers (`1`, `2`, or `3`) is matched to its own picture. The picture is shown on the LEDs when its matching number is picked.
|
In a later step, each of the possible numbers (`1`, `2`, or `3`) is matched to its own picture. The picture is shown on the LEDs when its matching number is picked.
|
||||||
@ -42,6 +41,22 @@ Place an ``||logic:if||`` block under the ``||math:pick random||`` and check whe
|
|||||||
|
|
||||||

|

|
||||||
|
|
||||||
|
```blocks
|
||||||
|
let hand = 0;
|
||||||
|
input.onGesture(Gesture.Shake, () => {
|
||||||
|
hand = Math.randomRange(1, 3)
|
||||||
|
if (hand == 1) {
|
||||||
|
basic.showLeds(`
|
||||||
|
# # # # #
|
||||||
|
# . . . #
|
||||||
|
# . . . #
|
||||||
|
# . . . #
|
||||||
|
# # # # #
|
||||||
|
`)
|
||||||
|
}
|
||||||
|
})
|
||||||
|
```
|
||||||
|
|
||||||
## Step 5 @fullscreen
|
## Step 5 @fullscreen
|
||||||
|
|
||||||
Click on the **SHAKE** button in the simulator. If you try enough times, you should see a picture of paper on the screen.
|
Click on the **SHAKE** button in the simulator. If you try enough times, you should see a picture of paper on the screen.
|
||||||
@ -50,10 +65,28 @@ Click on the **SHAKE** button in the simulator. If you try enough times, you sho
|
|||||||
|
|
||||||
## Step 6 @fullscreen
|
## Step 6 @fullscreen
|
||||||
|
|
||||||
Click the ``+`` button to add an ``||logic:else||`` section.
|
Click the **(+)** button to add an ``||logic:else||`` section.
|
||||||
|
|
||||||

|

|
||||||
|
|
||||||
|
```blocks
|
||||||
|
let hand = 0;
|
||||||
|
input.onGesture(Gesture.Shake, () => {
|
||||||
|
hand = Math.randomRange(1, 3)
|
||||||
|
if (hand == 1) {
|
||||||
|
basic.showLeds(`
|
||||||
|
# # # # #
|
||||||
|
# . . . #
|
||||||
|
# . . . #
|
||||||
|
# . . . #
|
||||||
|
# # # # #
|
||||||
|
`)
|
||||||
|
} else {
|
||||||
|
|
||||||
|
}
|
||||||
|
})
|
||||||
|
```
|
||||||
|
|
||||||
## Step 7 @fullscreen
|
## Step 7 @fullscreen
|
||||||
|
|
||||||
Add a ``||basic:show leds||`` block inside the ``||logic:else||``. Make a picture of a scissors in the LEDs.
|
Add a ``||basic:show leds||`` block inside the ``||logic:else||``. Make a picture of a scissors in the LEDs.
|
||||||
|
BIN
docs/static/mb/projects/rock-paper-scissors/if.gif
vendored
BIN
docs/static/mb/projects/rock-paper-scissors/if.gif
vendored
Binary file not shown.
Before Width: | Height: | Size: 413 KiB After Width: | Height: | Size: 436 KiB |
Loading…
x
Reference in New Issue
Block a user