pxt-microbit 5.1.32 → 5.1.34
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/built/block-tests.js +1 -1
- package/built/common-sim.d.ts +8 -2
- package/built/common-sim.js +21 -0
- package/built/editor.js +8 -1
- package/built/sim.d.ts +9 -3
- package/built/sim.js +30 -5
- package/built/target.js +1 -1
- package/built/target.json +1 -1
- package/built/targetlight.json +1 -1
- package/built/theme.json +1 -1
- package/built/web/react-common-authcode.css +1 -1
- package/built/web/react-common-multiplayer.css +1 -1
- package/built/web/react-common-skillmap.css +1 -1
- package/built/web/rtlreact-common-authcode.css +1 -1
- package/built/web/rtlreact-common-multiplayer.css +1 -1
- package/built/web/rtlreact-common-skillmap.css +1 -1
- package/built/web/rtlsemantic.css +1 -1
- package/built/web/semantic.css +1 -1
- package/docs/projects/7-seconds.md +5 -1
- package/docs/projects/coin-flipper.md +9 -5
- package/docs/projects/compass.md +27 -23
- package/docs/projects/dice.md +9 -5
- package/docs/projects/flashing-heart.md +4 -0
- package/docs/projects/hot-potato.md +4 -0
- package/docs/projects/level.md +3 -0
- package/docs/projects/love-meter.md +13 -9
- package/docs/projects/micro-chat.md +7 -3
- package/docs/projects/name-tag.md +9 -5
- package/docs/projects/plot-acceleration.md +4 -0
- package/docs/projects/rock-paper-scissors-v2.md +5 -1
- package/docs/projects/rock-paper-scissors.md +11 -7
- package/docs/projects/smiley-buttons.md +11 -8
- package/docs/projects/stopwatch.md +5 -1
- package/docs/projects/v2-blow-away.md +28 -88
- package/docs/projects/v2-cat-napping.md +51 -72
- package/docs/projects/v2-clap-lights.md +16 -50
- package/docs/projects/v2-countdown.md +15 -47
- package/docs/projects/v2-morse-chat.md +55 -60
- package/docs/projects/v2-pet-hamster.md +16 -50
- package/docs/tours/editor-tour.md +12 -0
- package/package.json +3 -3
- package/pxtarget.json +3 -1
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
# Countdown
|
|
2
2
|
|
|
3
|
-
##
|
|
3
|
+
## Introduction @unplugged
|
|
4
4
|
|
|
5
5
|
🎇3...🎇2...🎇1...
|
|
6
6
|
🎆GO!🎆
|
|
@@ -9,16 +9,11 @@ Let's create a musical countdown using the new @boardname@ with sound!
|
|
|
9
9
|
|
|
10
10
|

|
|
11
11
|
|
|
12
|
-
##
|
|
13
|
-
|
|
14
|
-
➰ **All looped up** ➰
|
|
12
|
+
## Setting up the loop
|
|
15
13
|
|
|
16
14
|
We'll begin by using a [__*for loop*__](#forLoop "repeat code for a given number of times using an index") to recreate the same sound 3 times.
|
|
17
15
|
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
► From the ``||loops:Loops||`` category in your toolbox, find the ``||loops:for [index] from 0 to [4]||`` loop and add it to your ``||basic:on start||`` container.
|
|
21
|
-
|
|
16
|
+
► From the ``||loops:Loops||`` category in your toolbox, find the ``||loops:for [index] from 0 to [4]||`` loop and add it to your ``||basic:on start||`` container.
|
|
22
17
|
► Change your loop to count from ``0`` to **``2``**.
|
|
23
18
|
💡 This means the loop will count 0-1-2 instead of what we want, which is 3-2-1. We will worry about this later!
|
|
24
19
|
|
|
@@ -29,15 +24,10 @@ for (let index = 0; index <= 2; index++) {
|
|
|
29
24
|
}
|
|
30
25
|
```
|
|
31
26
|
|
|
32
|
-
##
|
|
33
|
-
|
|
34
|
-
🎵 **Musical loops** 🎵
|
|
35
|
-
|
|
36
|
-
---
|
|
27
|
+
## Play music
|
|
37
28
|
|
|
38
29
|
► From ``||music:Music||``, grab ``||music:play tone [Middle C] for [1 beat]||`` and snap it into your empty ``for`` loop.
|
|
39
|
-
💡 Your simulator might start playing music. You can mute it if distracting.
|
|
40
|
-
|
|
30
|
+
💡 Your simulator might start playing music. You can mute it if distracting.
|
|
41
31
|
► 1 beat is a little long. Use the **dropdown** to set the tone to play for ``||music:1/4 beat||``.
|
|
42
32
|
|
|
43
33
|
```blocks
|
|
@@ -47,18 +37,12 @@ for (let index = 0; index <= 2; index++) {
|
|
|
47
37
|
}
|
|
48
38
|
```
|
|
49
39
|
|
|
50
|
-
##
|
|
51
|
-
|
|
52
|
-
✨ **Razzle dazzle down** ✨
|
|
40
|
+
## Showing a number
|
|
53
41
|
|
|
54
42
|
With every tone, we also want to **display** our countdown.
|
|
55
43
|
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
► From ``||basic:Basic||``, find ``||basic:show number [0]||`` and snap it in at the **bottom** of your ``for`` loop.
|
|
59
|
-
|
|
60
|
-
► From your ``||loops:for [index] from 0 to [2]||`` loop condition, click and drag out the **red** ``||variables:index||`` variable.
|
|
61
|
-
|
|
44
|
+
► From ``||basic:Basic||``, find ``||basic:show number [0]||`` and snap it in at the **bottom** of your ``for`` loop.
|
|
45
|
+
► From your ``||loops:for [index] from 0 to [2]||`` loop condition, click and drag out the **red** ``||variables:index||`` variable.
|
|
62
46
|
► Use the ``||variables:index||`` that you dragged out to **replace** the ``0`` in ``||basic:show number [0]||``.
|
|
63
47
|
|
|
64
48
|
```blocks
|
|
@@ -69,18 +53,14 @@ for (let index = 0; index <= 2; index++) {
|
|
|
69
53
|
}
|
|
70
54
|
```
|
|
71
55
|
|
|
72
|
-
##
|
|
56
|
+
## Inverting the number
|
|
73
57
|
|
|
74
58
|
If you take a look at your simulator, you'll notice the @boardname@ flashing 0-1-2. We want it to say 3-2-1! Let's learn a trick to change that.
|
|
75
59
|
|
|
76
|
-
---
|
|
77
|
-
|
|
78
60
|
► From the ``||math:Math||`` category, snap ``||math:[0] - [0]||`` in to **replace** ``||variables:index||`` in your ``||basic:show number [index]||`` block.
|
|
79
|
-
💡 You should now have a greyed out ``index`` variable in your workspace. We'll use that in the next step.
|
|
80
|
-
|
|
61
|
+
💡 You should now have a greyed out ``index`` variable in your workspace. We'll use that in the next step.
|
|
81
62
|
► Pick up the greyed out ``||variables:index||`` variable and snap it in to the **right side** of your ``||math:[0] - [0]||`` operator.
|
|
82
|
-
💡 Can't find ``||variables:index||``? Try moving your ``||basic:on start||`` container to see if ``||variables: index||`` is hiding behind it!
|
|
83
|
-
|
|
63
|
+
💡 Can't find ``||variables:index||``? Try moving your ``||basic:on start||`` container to see if ``||variables: index||`` is hiding behind it!
|
|
84
64
|
► Set the **left side** of your ``||math:[0]-[index]||`` operator to **``3``**.
|
|
85
65
|
💡 Why does this work? Every time we loop, our ``index`` variable will grow by 1 and our @boardname@ will output: 3-0 = **3** ➡️ 3-1 = **2** ➡️ 3-2 = **1**!
|
|
86
66
|
|
|
@@ -92,14 +72,9 @@ for (let index = 0; index <= 2; index++) {
|
|
|
92
72
|
}
|
|
93
73
|
```
|
|
94
74
|
|
|
95
|
-
##
|
|
96
|
-
|
|
97
|
-
🏁 **You had me at "GO!"** 🏁
|
|
98
|
-
|
|
99
|
-
---
|
|
100
|
-
|
|
101
|
-
► From ``||basic:Basic||``, grab ``||basic:show string ["Hello!"]||`` and snap it into the **very bottom** of your ``||basic:on start||`` container.
|
|
75
|
+
## Printing "GO!"
|
|
102
76
|
|
|
77
|
+
► From ``||basic:Basic||``, grab ``||basic:show string ["Hello!"]||`` and snap it into the **very bottom** of your ``||basic:on start||`` container.
|
|
103
78
|
► Replace ``Hello!`` with the word ``GO!``
|
|
104
79
|
|
|
105
80
|
```blocks
|
|
@@ -111,15 +86,10 @@ for (let index = 0; index <= 2; index++) {
|
|
|
111
86
|
basic.showString("GO!")
|
|
112
87
|
```
|
|
113
88
|
|
|
114
|
-
##
|
|
115
|
-
|
|
116
|
-
🏇 **And we're off!** 🏇
|
|
117
|
-
|
|
118
|
-
---
|
|
89
|
+
## Adding a "GO!" noise
|
|
119
90
|
|
|
120
91
|
► From the ``||music:Music||`` category, grab ``||music:play tone [Middle C] for [1 beat]||`` and place it **above** your ``||basic:show string ["GO!"]||`` block and **below** your ``||loops:for||`` loop.
|
|
121
|
-
💡 This will let your @boardname@ play the sound and show ``GO!`` at the same time.
|
|
122
|
-
|
|
92
|
+
💡 This will let your @boardname@ play the sound and show ``GO!`` at the same time.
|
|
123
93
|
► Set the ``||music:tone||`` to be ``Middle G``.
|
|
124
94
|
💡 ``Middle G`` is also tone ``392``.
|
|
125
95
|
|
|
@@ -135,8 +105,6 @@ basic.showString("GO!")
|
|
|
135
105
|
|
|
136
106
|
## 8. Testing in the simulator
|
|
137
107
|
|
|
138
|
-
🚦 **Test what you've created** 🚦
|
|
139
|
-
|
|
140
108
|
Make sure your speakers are on and check out the simulator!
|
|
141
109
|
|
|
142
110
|
If you have a @boardname@ with sound (the one with the **shiny gold** logo at the top), no need to plug in an external speaker - just download this code and try it out!
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
# Morse Chat
|
|
2
2
|
|
|
3
|
-
##
|
|
3
|
+
## Introducing Sky @unplugged
|
|
4
4
|
|
|
5
5
|
🐷 Meet Sky, the pig! Sky can only communicate using [__*morse code*__](#morsecode "an alphabet composed of dots (short signals) and dashes (long signals)").
|
|
6
6
|
|
|
@@ -8,14 +8,9 @@ Luckily, you can use your @boardname@ with sound to talk to Sky 👋
|
|
|
8
8
|
|
|
9
9
|

|
|
10
10
|
|
|
11
|
-
##
|
|
12
|
-
|
|
13
|
-
⚙️ **Communication works best when set up properly** ⚙️
|
|
14
|
-
|
|
15
|
-
---
|
|
16
|
-
|
|
17
|
-
► From the ``||input:Input||`` category in the toolbox, drag an ``||input:on logo [pressed]||`` container into to your workspace.
|
|
11
|
+
## Setup
|
|
18
12
|
|
|
13
|
+
► From the ``||input:Input||`` category in the toolbox, drag an ``||input:on logo [pressed]||`` container into to your workspace.
|
|
19
14
|
► From the ``||radio:Radio||`` category, get ``||radio:radio send number [0]||`` and snap it into your empty ``||input:on logo [pressed]||`` container.
|
|
20
15
|
|
|
21
16
|
```blocks
|
|
@@ -24,15 +19,10 @@ input.onLogoEvent(TouchButtonEvent.Pressed, function () {
|
|
|
24
19
|
})
|
|
25
20
|
```
|
|
26
21
|
|
|
27
|
-
##
|
|
28
|
-
|
|
29
|
-
💬 **Sending Sky two _different_ messages** 💬
|
|
30
|
-
|
|
31
|
-
---
|
|
22
|
+
## Sending different messages pt. 1
|
|
32
23
|
|
|
33
24
|
► From ``||input:Input||``, grab **another** ``||input:on logo [pressed]||`` container and add it to your workspace.
|
|
34
|
-
💡 This container is greyed out because it matches another. Let's change that!
|
|
35
|
-
|
|
25
|
+
💡 This container is greyed out because it matches another. Let's change that!
|
|
36
26
|
► On the greyed-out ``||input:on logo [pressed]||`` container, click on the **``pressed``** dropdown and set it to ``||input:long pressed||``.
|
|
37
27
|
|
|
38
28
|
```blocks
|
|
@@ -44,10 +34,9 @@ input.onLogoEvent(TouchButtonEvent.Pressed, function () {
|
|
|
44
34
|
})
|
|
45
35
|
```
|
|
46
36
|
|
|
47
|
-
##
|
|
37
|
+
## Sending different messages pt. 2
|
|
48
38
|
|
|
49
39
|
► From the ``||radio:Radio||`` category, get a ``||radio:radio send number [0]||`` block and snap it into your **empty** ``||input:on logo [long pressed]||`` container.
|
|
50
|
-
|
|
51
40
|
► Set the number to be ``1``.
|
|
52
41
|
|
|
53
42
|
```blocks
|
|
@@ -60,16 +49,12 @@ input.onLogoEvent(TouchButtonEvent.Pressed, function () {
|
|
|
60
49
|
})
|
|
61
50
|
```
|
|
62
51
|
|
|
63
|
-
##
|
|
52
|
+
## Receiving different messages
|
|
64
53
|
|
|
65
54
|
To ensure Sky gets the right message, we will use an [__*if then / else*__](#ifthenelse "runs some code if a boolean condition is true and different code if the condition is false") conditional statement.
|
|
66
55
|
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
► From ``||radio:Radio||``, find the ``||radio:on radio received [receivedNumber]||`` container and add it to your workspace.
|
|
70
|
-
|
|
71
|
-
► From ``||logic:Logic||``, grab an ``||logic:if <true> then / else||`` statement and snap it into your **new** ``||radio:on radio received [receivedNumber]||`` container.
|
|
72
|
-
|
|
56
|
+
► From ``||radio:Radio||``, find the ``||radio:on radio received [receivedNumber]||`` container and add it to your workspace.
|
|
57
|
+
► From ``||logic:Logic||``, grab an ``||logic:if <true> then / else||`` statement and snap it into your **new** ``||radio:on radio received [receivedNumber]||`` container.
|
|
73
58
|
► Go back to the ``||logic:Logic||`` category, grab ``||logic:<[0] [=] [0]>||``, and click it in to **replace** the ``||logic:<true>||`` argument in your ``||logic:if <true> then / else||`` statement.
|
|
74
59
|
|
|
75
60
|
```blocks
|
|
@@ -83,10 +68,9 @@ radio.onReceivedNumber(function (receivedNumber) {
|
|
|
83
68
|
})
|
|
84
69
|
```
|
|
85
70
|
|
|
86
|
-
##
|
|
87
|
-
|
|
88
|
-
► From your ``||radio:on radio received [receivedNumber]||`` container, grab the **``receivedNumber``** input and drag out a copy.
|
|
71
|
+
## Conditioning on the input
|
|
89
72
|
|
|
73
|
+
► From your ``||radio:on radio received [receivedNumber]||`` container, grab the **``receivedNumber``** input and drag out a copy.
|
|
90
74
|
► Use your copy of **``receivedNumber``** to replace the ``[0]`` on the **left side** of ``||logic:<[0] [=] [0]>||``.
|
|
91
75
|
|
|
92
76
|
```blocks
|
|
@@ -100,12 +84,9 @@ radio.onReceivedNumber(function (receivedNumber) {
|
|
|
100
84
|
})
|
|
101
85
|
```
|
|
102
86
|
|
|
103
|
-
##
|
|
104
|
-
|
|
105
|
-
📃 **Dashing through the lights** 📃
|
|
106
|
-
|
|
107
|
-
► We want to display a dash if the logo is long pressed. From ``||basic:Basic||``, grab ``||basic:show leds||`` and snap it into the empty **bottom container** of your ``||logic:if then / else||`` statement.
|
|
87
|
+
## Displaying a message pt. 1
|
|
108
88
|
|
|
89
|
+
► We want to display a dash if the logo is long pressed. From ``||basic:Basic||``, grab ``||basic:show leds||`` and snap it into the empty **bottom container** of your ``||logic:if then / else||`` statement.
|
|
109
90
|
► Turn on 3 LEDs in a row to be a dash: -
|
|
110
91
|
|
|
111
92
|
```blocks
|
|
@@ -124,11 +105,7 @@ radio.onReceivedNumber(function (receivedNumber) {
|
|
|
124
105
|
})
|
|
125
106
|
```
|
|
126
107
|
|
|
127
|
-
##
|
|
128
|
-
|
|
129
|
-
🎵 **Adding sound** 🎵
|
|
130
|
-
|
|
131
|
-
---
|
|
108
|
+
## Playing a sound pt. 1
|
|
132
109
|
|
|
133
110
|
► From the ``||music:Music||`` category, grab a ``||music:play tone [Middle C] for [1 beat]||`` block and snap it at the **end** of the **bottom container** in your ``||logic:if then / else||`` statement.
|
|
134
111
|
|
|
@@ -149,14 +126,9 @@ radio.onReceivedNumber(function (receivedNumber) {
|
|
|
149
126
|
})
|
|
150
127
|
```
|
|
151
128
|
|
|
152
|
-
##
|
|
153
|
-
|
|
154
|
-
⚫ **Dot dot dot** ⚫
|
|
155
|
-
|
|
156
|
-
---
|
|
157
|
-
|
|
158
|
-
► We want to display a dot if the logo is pressed. From ``||basic:Basic||``, grab another ``||basic:show leds||`` and snap it into the **top container** of your ``||logic:if then / else||`` statement.
|
|
129
|
+
## Displaying a message pt. 2
|
|
159
130
|
|
|
131
|
+
► We want to display a dot if the logo is pressed. From ``||basic:Basic||``, grab another ``||basic:show leds||`` and snap it into the **top container** of your ``||logic:if then / else||`` statement.
|
|
160
132
|
► Turn on a single LED to make a dot: .
|
|
161
133
|
|
|
162
134
|
```blocks
|
|
@@ -183,10 +155,9 @@ radio.onReceivedNumber(function (receivedNumber) {
|
|
|
183
155
|
})
|
|
184
156
|
```
|
|
185
157
|
|
|
186
|
-
##
|
|
187
|
-
|
|
188
|
-
► From the ``||music:Music||`` category, grab ``||music:play tone [Middle C] for [1 beat]||`` and snap it in at the **end** of the **top container** in your ``||logic:if then / else||`` statement.
|
|
158
|
+
## Playing a sound pt. 2
|
|
189
159
|
|
|
160
|
+
► From the ``||music:Music||`` category, grab ``||music:play tone [Middle C] for [1 beat]||`` and snap it in at the **end** of the **top container** in your ``||logic:if then / else||`` statement.
|
|
190
161
|
► Dots are shorter than dashes! Set the tone to play for ``1/4 beat``.
|
|
191
162
|
|
|
192
163
|
```blocks
|
|
@@ -214,11 +185,7 @@ radio.onReceivedNumber(function (receivedNumber) {
|
|
|
214
185
|
})
|
|
215
186
|
```
|
|
216
187
|
|
|
217
|
-
##
|
|
218
|
-
|
|
219
|
-
🗨️ **Clear the lights once the messages are sent** 🗨️
|
|
220
|
-
|
|
221
|
-
---
|
|
188
|
+
## Clearing the screens
|
|
222
189
|
|
|
223
190
|
► From ``||basic:Basic||``, find ``||basic:clear screen||`` and snap it in at the **very bottom** of your ``||radio:on radio received [receivedNumber]||`` container.
|
|
224
191
|
|
|
@@ -248,21 +215,49 @@ radio.onReceivedNumber(function (receivedNumber) {
|
|
|
248
215
|
})
|
|
249
216
|
```
|
|
250
217
|
|
|
251
|
-
##
|
|
218
|
+
## Testing in the simulator - Connect!
|
|
252
219
|
|
|
253
|
-
|
|
220
|
+
Test what you've created. Remember to turn your sound on!
|
|
254
221
|
|
|
255
|
-
|
|
222
|
+
► Touch the gold **micro:bit logo** at the top of your @boardname@ on the simulator. You'll notice that a second @boardname@ appears. This is the @boardname@ for Sky 🐖
|
|
223
|
+
💡 If your screen is too small, you might not be able to see it.
|
|
256
224
|
|
|
257
|
-
|
|
225
|
+
```blocks
|
|
226
|
+
radio.onReceivedNumber(function (receivedNumber) {
|
|
227
|
+
if (receivedNumber == 0) {
|
|
228
|
+
basic.showLeds(`
|
|
229
|
+
. . . . .
|
|
230
|
+
. . . . .
|
|
231
|
+
. . # . .
|
|
232
|
+
. . . . .
|
|
233
|
+
. . . . .
|
|
234
|
+
`)
|
|
235
|
+
music.playTone(262, music.beat(BeatFraction.Quarter))
|
|
236
|
+
} else {
|
|
237
|
+
basic.showLeds(`
|
|
238
|
+
. . . . .
|
|
239
|
+
. . . . .
|
|
240
|
+
. # # # .
|
|
241
|
+
. . . . .
|
|
242
|
+
. . . . .
|
|
243
|
+
`)
|
|
244
|
+
music.playTone(262, music.beat(BeatFraction.Whole))
|
|
245
|
+
}
|
|
246
|
+
basic.clearScreen()
|
|
247
|
+
})
|
|
248
|
+
input.onLogoEvent(TouchButtonEvent.LongPressed, function () {
|
|
249
|
+
radio.sendNumber(1)
|
|
250
|
+
})
|
|
251
|
+
input.onLogoEvent(TouchButtonEvent.Pressed, function () {
|
|
252
|
+
radio.sendNumber(0)
|
|
253
|
+
})
|
|
254
|
+
```
|
|
258
255
|
|
|
259
|
-
|
|
260
|
-
💡 If your screen is too small, you might not be able to see it.
|
|
256
|
+
## Testing in the simulator - Send message
|
|
261
257
|
|
|
262
258
|
► Touch the logo again to send messages to Sky 🐖
|
|
263
259
|
**Press** to send a dot.
|
|
264
|
-
**Long press** (count to 3!) to send a dash.
|
|
265
|
-
|
|
260
|
+
**Long press** (count to 3!) to send a dash.
|
|
266
261
|
► If you have multiple @boardname@s with sound (they have **shiny gold** logos at the top), download this code and try it out!
|
|
267
262
|
|
|
268
263
|
```blocks
|
|
@@ -1,41 +1,26 @@
|
|
|
1
1
|
# Pet Hamster
|
|
2
2
|
|
|
3
|
-
##
|
|
4
|
-
|
|
5
|
-
👋 Meet your new pet hamster, Cyrus 🐹
|
|
3
|
+
## Introduction @unplugged
|
|
6
4
|
|
|
7
5
|

|
|
8
6
|
|
|
9
|
-
##
|
|
10
|
-
|
|
11
|
-
😴 **Sleeping on the job** 😴
|
|
7
|
+
## Cyrus's asleep face
|
|
12
8
|
|
|
13
9
|
Cyrus is a very sleepy hamster. In fact, Cyrus is almost always sleeping.
|
|
14
10
|
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
► From the ``||basic:Basic||`` category, find ``||basic:show icon [ ]||`` and snap it into your ``||basic:on start||`` container.
|
|
18
|
-
|
|
19
|
-
► Set it to show the asleep ``-_-`` face.
|
|
11
|
+
► From the ``||basic:Basic||`` category, find ``||basic:show icon [ ]||`` and snap it into your ``||basic:on start||`` container. Set it to show the asleep ``-_-`` face.
|
|
20
12
|
💡 In the ``show icon`` dropdown menu options, you can hover to see what each design is called!
|
|
21
13
|
|
|
22
14
|
```blocks
|
|
23
15
|
basic.showIcon(IconNames.Asleep)
|
|
24
16
|
```
|
|
25
17
|
|
|
26
|
-
##
|
|
27
|
-
|
|
28
|
-
🤣 **That tickles** 🤣
|
|
18
|
+
## Giggly Cyrus
|
|
29
19
|
|
|
30
20
|
Pressing Cyrus's logo tickles them!
|
|
31
21
|
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
► From ``||input:Input||``, find the ``||input:on logo [pressed]||`` container and drag it into your workspace.
|
|
35
|
-
|
|
36
|
-
► Go to ``||basic:Basic||`` and grab **another** ``||basic:show icon [ ]||``. Snap it into your **empty** ``||input:on logo [pressed]||`` container.
|
|
37
|
-
|
|
38
|
-
► Set the icon (Cyrus's face) to happy ``:)``.
|
|
22
|
+
► From ``||input:Input||``, find the ``||input:on logo [pressed]||`` container and drag it into your workspace.
|
|
23
|
+
► Go to ``||basic:Basic||`` and grab **another** ``||basic:show icon [ ]||``. Snap it into your **empty** ``||input:on logo [pressed]||`` container. Set the icon (Cyrus's face) to happy ``:)``.
|
|
39
24
|
|
|
40
25
|
```blocks
|
|
41
26
|
input.onLogoEvent(TouchButtonEvent.Pressed, function () {
|
|
@@ -43,11 +28,7 @@ input.onLogoEvent(TouchButtonEvent.Pressed, function () {
|
|
|
43
28
|
})
|
|
44
29
|
```
|
|
45
30
|
|
|
46
|
-
##
|
|
47
|
-
|
|
48
|
-
🎶 **The sounds of Cyrus** 🎶
|
|
49
|
-
|
|
50
|
-
---
|
|
31
|
+
## Tickle sound
|
|
51
32
|
|
|
52
33
|
► From the ``||music:Music||`` category, get a ``||music:play sound [giggle] until done||`` and add it to the **bottom** of your ``||input:on logo [pressed]||`` container.
|
|
53
34
|
|
|
@@ -59,19 +40,12 @@ input.onLogoEvent(TouchButtonEvent.Pressed, function () {
|
|
|
59
40
|
})
|
|
60
41
|
```
|
|
61
42
|
|
|
62
|
-
##
|
|
63
|
-
|
|
64
|
-
😵 **All shaken up** 💫
|
|
43
|
+
## Dizzy Cyrus
|
|
65
44
|
|
|
66
45
|
Whenever Cyrus is shaken, they get sad 🙁
|
|
67
46
|
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
► From ``||input:Input||``, find ``||input:on [shake]||`` and drag it into your workspace.
|
|
71
|
-
|
|
72
|
-
► From the ``||basic:Basic||`` category, grab ``||basic:show icon [ ]||`` and snap it into your **new** ``||input:on [shake]||`` container.
|
|
73
|
-
|
|
74
|
-
► Set the icon (Cyrus's face) to sad ``:(``.
|
|
47
|
+
► From ``||input:Input||``, find ``||input:on [shake]||`` and drag it into your workspace.
|
|
48
|
+
► From the ``||basic:Basic||`` category, grab ``||basic:show icon [ ]||`` and snap it into your **new** ``||input:on [shake]||`` container. Set the icon (Cyrus's face) to sad ``:(``.
|
|
75
49
|
|
|
76
50
|
```blocks
|
|
77
51
|
input.onGesture(Gesture.Shake, function () {
|
|
@@ -79,10 +53,9 @@ input.onGesture(Gesture.Shake, function () {
|
|
|
79
53
|
})
|
|
80
54
|
```
|
|
81
55
|
|
|
82
|
-
##
|
|
83
|
-
|
|
84
|
-
► From the ``||music:Music||`` category, find the ``||music:play sound [giggle] until done||`` block and add it to the **bottom** of your ``||input:on [shake]||`` container.
|
|
56
|
+
## Dizzy sound
|
|
85
57
|
|
|
58
|
+
► From the ``||music:Music||`` category, find the ``||music:play sound [giggle] until done||`` block and add it to the **bottom** of your ``||input:on [shake]||`` container.
|
|
86
59
|
► Click on the **dropdown** and set it so Cyrus plays a ``||music:sad||`` sound until done.
|
|
87
60
|
|
|
88
61
|
```blocks
|
|
@@ -93,16 +66,11 @@ input.onGesture(Gesture.Shake, function () {
|
|
|
93
66
|
})
|
|
94
67
|
```
|
|
95
68
|
|
|
96
|
-
##
|
|
97
|
-
|
|
98
|
-
💤 **Back to sleep** 💤
|
|
69
|
+
## Cyrus's default face pt. 1
|
|
99
70
|
|
|
100
71
|
Let's ensure that Cyrus will always go back to sleep after being shaken or tickled.
|
|
101
72
|
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
► Right click the ``||basic:show icon[-_-]||`` block in your workspace (inside the ``||basic:on start||`` container) and choose **Duplicate**.
|
|
105
|
-
|
|
73
|
+
► Right click the ``||basic:show icon[-_-]||`` block in your workspace (inside the ``||basic:on start||`` container) and choose **Duplicate**.
|
|
106
74
|
► Snap your copied block in at the **very bottom** of your ``||input:on [shake]||`` container.
|
|
107
75
|
|
|
108
76
|
```blocks
|
|
@@ -119,7 +87,7 @@ input.onLogoEvent(TouchButtonEvent.Pressed, function () {
|
|
|
119
87
|
basic.showIcon(IconNames.Asleep)
|
|
120
88
|
```
|
|
121
89
|
|
|
122
|
-
##
|
|
90
|
+
## Cyrus's default face pt. 2
|
|
123
91
|
|
|
124
92
|
► Duplicate the ``||basic:show icon[-_-]||`` block again and this time snap it in at the **very bottom** of your ``||input:on logo [pressed]||`` container.
|
|
125
93
|
|
|
@@ -138,9 +106,7 @@ input.onLogoEvent(TouchButtonEvent.Pressed, function () {
|
|
|
138
106
|
basic.showIcon(IconNames.Asleep)
|
|
139
107
|
```
|
|
140
108
|
|
|
141
|
-
##
|
|
142
|
-
|
|
143
|
-
🐾 **Test what you've created** 🐾
|
|
109
|
+
## Testing in the simulator
|
|
144
110
|
|
|
145
111
|
Check out the simulator and make sure your speakers are on 🔊
|
|
146
112
|
|
|
@@ -20,12 +20,24 @@
|
|
|
20
20
|
* highlight: toolbox
|
|
21
21
|
* location: right
|
|
22
22
|
|
|
23
|
+
## Toolbox
|
|
24
|
+
* title: Toolbox
|
|
25
|
+
* description: Drag out snippets of code from the Toolbox categories into the Workspace.
|
|
26
|
+
* highlight: monaco toolbox
|
|
27
|
+
* location: right
|
|
28
|
+
|
|
23
29
|
## Workspace
|
|
24
30
|
* title: Workspace
|
|
25
31
|
* description: Snap blocks of code together to build your program.
|
|
26
32
|
* highlight: workspace
|
|
27
33
|
* location: center
|
|
28
34
|
|
|
35
|
+
## Workspace
|
|
36
|
+
* title: Workspace
|
|
37
|
+
* description: Write code to build your program.
|
|
38
|
+
* highlight: monaco workspace
|
|
39
|
+
* location: center
|
|
40
|
+
|
|
29
41
|
## Share
|
|
30
42
|
* title: Share
|
|
31
43
|
* description: Create a link to your project to share with others.
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "pxt-microbit",
|
|
3
|
-
"version": "5.1.
|
|
3
|
+
"version": "5.1.34",
|
|
4
4
|
"description": "micro:bit target for Microsoft MakeCode (PXT)",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"JavaScript",
|
|
@@ -45,7 +45,7 @@
|
|
|
45
45
|
"typescript": "4.2.3"
|
|
46
46
|
},
|
|
47
47
|
"dependencies": {
|
|
48
|
-
"pxt-common-packages": "10.4.
|
|
49
|
-
"pxt-core": "8.6.
|
|
48
|
+
"pxt-common-packages": "10.4.10",
|
|
49
|
+
"pxt-core": "8.6.47"
|
|
50
50
|
}
|
|
51
51
|
}
|
package/pxtarget.json
CHANGED
|
@@ -539,6 +539,7 @@
|
|
|
539
539
|
"simScreenshot": true,
|
|
540
540
|
"simScreenshotMaxUriLength": 300000,
|
|
541
541
|
"simGif": true,
|
|
542
|
+
"simGifWidth": 240,
|
|
542
543
|
"qrCode": true,
|
|
543
544
|
"importExtensionFiles": true,
|
|
544
545
|
"nameProjectFirst": true,
|
|
@@ -573,7 +574,8 @@
|
|
|
573
574
|
},
|
|
574
575
|
"tutorialSimSidebarLayout": true,
|
|
575
576
|
"preferWebUSBDownload": true,
|
|
576
|
-
"hideReplaceMyCode": true
|
|
577
|
+
"hideReplaceMyCode": true,
|
|
578
|
+
"matchWebUSBDeviceInSim": true
|
|
577
579
|
},
|
|
578
580
|
"queryVariants": {
|
|
579
581
|
"hidemenu": {
|