Edit the 'dice' project slightly (#1202)
This commit is contained in:
parent
69599635c3
commit
e27232667d
@ -4,12 +4,11 @@
|
|||||||
|
|
||||||
![A microbit dice](/static/mb/projects/dice.png)
|
![A microbit dice](/static/mb/projects/dice.png)
|
||||||
|
|
||||||
Let's turn the @boardname@ into a dice! To do so, we need 3 pieces of code: detect a throw (shake),
|
Let's turn the @boardname@ into a dice! To do this, we need 3 pieces of code: one to detect a throw (shake), another to pick a random number, and then one to show the number.
|
||||||
pick a random number, show the number.
|
|
||||||
|
|
||||||
## Step 1 @fullscreen
|
## Step 1 @fullscreen
|
||||||
|
|
||||||
Place the ``||input:on shake||`` block. It runs code when you shake the @boardname@.
|
Place the ``||input:on shake||`` block onto the editor workspace. It runs code when you shake the @boardname@.
|
||||||
|
|
||||||
```blocks
|
```blocks
|
||||||
input.onGesture(Gesture.Shake, () => {
|
input.onGesture(Gesture.Shake, () => {
|
||||||
@ -19,7 +18,7 @@ input.onGesture(Gesture.Shake, () => {
|
|||||||
|
|
||||||
## Step 2 @fullscreen
|
## Step 2 @fullscreen
|
||||||
|
|
||||||
Place the ``||basic:show number||`` block in the ``||input:on shake||`` block to display a number.
|
Get a ``||basic:show number||`` block and place it inside the ``||input:on shake||`` block to display a number.
|
||||||
|
|
||||||
```blocks
|
```blocks
|
||||||
input.onGesture(Gesture.Shake, () => {
|
input.onGesture(Gesture.Shake, () => {
|
||||||
@ -29,7 +28,7 @@ input.onGesture(Gesture.Shake, () => {
|
|||||||
|
|
||||||
## Step 3 @fullscreen
|
## Step 3 @fullscreen
|
||||||
|
|
||||||
Place the ``||Math:pick random||`` block in an ``||input:on shake||`` block to pick a random number.
|
Put a ``||Math:pick random||`` block in the ``||basic:show number||`` block to pick a random number.
|
||||||
|
|
||||||
```blocks
|
```blocks
|
||||||
input.onGesture(Gesture.Shake, () => {
|
input.onGesture(Gesture.Shake, () => {
|
||||||
|
Loading…
Reference in New Issue
Block a user