pxt-arcade 1.13.1 → 1.13.2

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.
Files changed (55) hide show
  1. package/built/sim.js +8 -0
  2. package/built/target.js +72 -72
  3. package/built/target.json +72 -72
  4. package/built/targetlight.json +4 -4
  5. package/docs/beta-ref.json +1 -1
  6. package/docs/hardware/kiosk.md +44 -77
  7. package/docs/hero-banner.md +9 -8
  8. package/docs/index-ref.json +1 -1
  9. package/docs/multiplayer-games.md +6 -0
  10. package/docs/projects.md +2 -1
  11. package/docs/skillmap/balloon/balloon1.md +3 -16
  12. package/docs/skillmap/balloon/balloon2.md +3 -15
  13. package/docs/skillmap/balloon/balloon3.md +3 -16
  14. package/docs/skillmap/balloon/balloon4.md +18 -17
  15. package/docs/skillmap/mole/mole1.md +15 -114
  16. package/docs/skillmap/mole/mole2.md +28 -105
  17. package/docs/skillmap/mole/mole3.md +9 -105
  18. package/docs/skillmap/mole/mole4.md +37 -125
  19. package/docs/stable-ref.json +1 -1
  20. package/docs/static/hardware/kiosk/hot-air-balloon.png +0 -0
  21. package/docs/static/hardware/kiosk/makecode-arcade-machines.jpg +0 -0
  22. package/docs/static/hardware/kiosk/no-uploaded-games.png +0 -0
  23. package/docs/static/hardware/kiosk/select-a-game.png +0 -0
  24. package/docs/static/hardware/kiosk/share-button.png +0 -0
  25. package/docs/static/hardware/kiosk/share-kiosk-button.png +0 -0
  26. package/docs/static/hardware/kiosk/share-kiosk-code.png +0 -0
  27. package/docs/static/hardware/kiosk/share-project.png +0 -0
  28. package/docs/static/hardware/kiosk/single-uploaded-game.png +0 -0
  29. package/docs/test/skillmap/balloon/balloon1.md +245 -0
  30. package/docs/test/skillmap/balloon/balloon2.md +365 -0
  31. package/docs/test/skillmap/balloon/balloon3.md +374 -0
  32. package/docs/test/skillmap/balloon/balloon4.md +389 -0
  33. package/docs/test/skillmap/dino/dino1.md +3 -3
  34. package/docs/test/skillmap/dino/dino2.md +9 -9
  35. package/docs/test/skillmap/mole/mole1.md +296 -0
  36. package/docs/test/skillmap/mole/mole2.md +345 -0
  37. package/docs/test/skillmap/mole/mole3.md +288 -0
  38. package/docs/test/skillmap/mole/mole4.md +431 -0
  39. package/docs/test/tutorials/arrow.md +71 -66
  40. package/docs/test/tutorials/collect-clovers.md +662 -891
  41. package/docs/test/tutorials/holiday.md +133 -192
  42. package/docs/test/tutorials/horse.md +227 -225
  43. package/docs/test/tutorials/time-flies.md +198 -117
  44. package/docs/tutorials/collect-the-clovers.md +662 -891
  45. package/docs/tutorials/froggy.md +198 -117
  46. package/package.json +2 -2
  47. package/docs/static/hardware/kiosk/add-to-kiosk.png +0 -0
  48. package/docs/static/hardware/kiosk/add-your-game.png +0 -0
  49. package/docs/static/hardware/kiosk/keyboard-controls.png +0 -0
  50. package/docs/static/hardware/kiosk/locked-state.png +0 -0
  51. package/docs/static/hardware/kiosk/menu-bar.png +0 -0
  52. package/docs/static/hardware/kiosk/multiple-uploaded-games.png +0 -0
  53. package/docs/static/hardware/kiosk/qr-code-enlarged.png +0 -0
  54. package/docs/static/hardware/kiosk/shared-project-link.png +0 -0
  55. package/docs/static/hardware/kiosk/shared-project-name.png +0 -0
@@ -24,7 +24,7 @@ Thank you to Deaf Kids Code for providing ASL video translations.
24
24
 
25
25
 
26
26
 
27
- ## {3. Your First Block}
27
+ ## {2. Your First Block}
28
28
 
29
29
  **Ready to start coding?**
30
30
 
@@ -66,7 +66,7 @@ scene.setBackgroundImage(img`.`)
66
66
  ```
67
67
 
68
68
 
69
- ## {4. Choose the grid}
69
+ ## {3. Choose the grid}
70
70
 
71
71
  **Choose the grassy grid.**
72
72
 
@@ -96,7 +96,7 @@ scene.setBackgroundImage(assets.image`grid`)
96
96
  ```
97
97
 
98
98
 
99
- ## {5. Check Your Game!}
99
+ ## {4. Check Your Game!}
100
100
 
101
101
 
102
102
  - :binoculars: Look at your project in the game window to see how it has changed!
@@ -116,7 +116,7 @@ hint~
116
116
 
117
117
 
118
118
 
119
- ## {6. Add the Sprite}
119
+ ## {5. Add the Sprite}
120
120
 
121
121
 
122
122
  Now we'll add the mole **SPRITE** to our game.
@@ -162,7 +162,7 @@ let myMole = sprites.create(img`.`, SpriteKind.Enemy)
162
162
 
163
163
 
164
164
 
165
- ## {7. Choose the Mole}
165
+ ## {6. Choose the Mole}
166
166
 
167
167
 
168
168
  - :mouse pointer: Click the empty square inside the new block and switch to the **My Assets** library.
@@ -193,14 +193,15 @@ let myMole = sprites.create(assets.image`mole`, SpriteKind.Enemy)
193
193
 
194
194
 
195
195
 
196
- ## {8. Make the Mole Move}
196
+ ## {7. Make the Mole Move}
197
197
 
198
198
  Let's get the mole jumping from hole to hole every second.
199
199
 
200
200
  - :circle: From the ``||game: Game||`` category **in the toolbox**, grab <br/>
201
201
  ```blocks
202
202
  game.onUpdateInterval(1000, function () {
203
- sprites.moveToRandomHoleOnGrid(myMole)
203
+ let mySprite: Sprite = null
204
+ simplified.moveToRandomHoleOnGrid(myMole)
204
205
  })
205
206
  ```
206
207
  <br/>and drop it onto **an empty area** of the workspace.
@@ -231,13 +232,13 @@ hint~
231
232
 
232
233
  ```blocks
233
234
  game.onUpdateInterval(1000, function () {
234
- sprites.moveToRandomHoleOnGrid(myMole)
235
+ simplified.moveToRandomHoleOnGrid(myMole)
235
236
  })
236
237
  ```
237
238
 
238
239
 
239
240
 
240
- ## {10. Check Your Game!}
241
+ ## {8. Check Your Game!}
241
242
 
242
243
 
243
244
  - :binoculars: Take a look at the game window to see your project!
@@ -248,7 +249,7 @@ You should see the mole changing spots every second.
248
249
 
249
250
 
250
251
 
251
- ## {11. Finale}
252
+ ## {9. Finale}
252
253
 
253
254
  **🎉 Way to Go 🎉**
254
255
 
@@ -265,120 +266,20 @@ When you're ready, click **Done** to return to the skillmap so you can add a rub
265
266
  let myMole = sprites.create(img`.`, SpriteKind.Enemy)
266
267
 
267
268
  game.onUpdateInterval(1000, function () {
268
- sprites.moveToRandomHoleOnGrid(myMole)
269
+ let mySprite: Sprite = null
270
+ simplified.moveToRandomHoleOnGrid(myMole)
269
271
  })
270
272
  carnival.startCountdownGame(15, carnival.WinTypes.Score)
271
-
273
+ simplified.moveToRandomHoleOnGrid(myMole)
272
274
  ```
273
275
 
274
- ```ghost
275
- carnival.startCountdownGame(15, carnival.WinTypes.Score)
276
- ```
277
276
 
278
277
 
279
278
  ```package
280
- simple-blocks=github:microsoft/arcade-tutorial-extensions/simple-blocks
281
279
  carnival=github:microsoft/arcade-carnival
280
+ mole-images=github:kiki-lee/mole-images#v0.0.2
282
281
  ```
283
282
 
284
- ```customts
285
-
286
- namespace controller{
287
-
288
- export enum Speeds {
289
- //% block="fast"
290
- Fast,
291
- //% block="medium"
292
- Med,
293
- //% block="slow"
294
- Slow
295
- }
296
-
297
-
298
- /**
299
- * Combines a simple "move with arrows"
300
- * and stay in screen
301
- */
302
- //% color="#d54322"
303
- //% blockId=move_only_onscreen_with_arrows
304
- //% block="move $thisSprite=variables_get(myHammer) on screen with speed $mySpeed"
305
- //% mySpeed.defl=Speeds.Fast
306
- //% inlineInputMode=inline
307
- export function moveOnlyOnscreenWithArrows(thisSprite: Sprite, mySpeed: Speeds) {
308
- thisSprite.setStayInScreen(true)
309
- if (mySpeed == Speeds.Fast) {
310
- controller.moveSprite(thisSprite, 225, 225)
311
- } else if (mySpeed == Speeds.Med) {
312
- controller.moveSprite(thisSprite, 175, 175)
313
- } else {
314
- controller.moveSprite(thisSprite, 100, 100)
315
- }
316
- }
317
-
318
- }
319
-
320
- namespace sprites {
321
-
322
- /**
323
- * Randomly moves mole to one of the holes on grid
324
- */
325
- //% color="#4b7bec"
326
- //% blockId=move_to_random_hole_on_grid
327
- //% block="move sprite $thisSprite=variables_get(myMole) to random area"
328
- //% inlineInputMode=inline
329
- export function moveToRandomHoleOnGrid(thisSprite: Sprite) {
330
- thisSprite.setPosition(simplified.chooseRandomNumber(28, 80, 130), simplified.chooseRandomNumber(21, 53, 85))
331
- simplified.still = 0;
332
- }
333
- }
334
-
335
-
336
- namespace simplified {
337
-
338
- export let still = 0;
339
-
340
- /**
341
- * Randomly chooses one of the parameter numbers
342
- *
343
- * @param choice1 Numeric choice to appear in the list of player choices
344
- * @param choice2 Numeric choice to appear in the list of player choices
345
- * @param choice3 Numeric choice to appear in the list of player choices
346
- * @param choice4 Numeric choice to appear in the list of player choices
347
- * @param choice5 Numeric choice to appear in the list of player choices
348
- */
349
-
350
- //% group=Arrays
351
- //% color="#fa8f08"
352
- //% blockId=choose_random_num_from_array
353
- //% block="choose one of $choice1 $choice2 $choice3 || $choice4 $choice5"
354
- //% choice1.defl=28
355
- //% choice2.defl=80
356
- //% choice3.defl=130
357
- //% inlineInputMode=inline
358
- export function chooseRandomNumber(choice1: number, choice2: number, choice3: number, choice4?: number, choice5?: number) {
359
- let myList = [choice1, choice2];
360
- if (choice3) myList.push(choice3);
361
- if (choice4) myList.push(choice4);
362
- if (choice5) myList.push(choice5);
363
- return myList._pickRandom();
364
- }
365
-
366
- /**
367
- * Checks to see if mole has been moved since last time position was checked
368
- */
369
-
370
- //% blockId=check_mole_escape
371
- //% block="check if mole has escaped"
372
- export function checkMoleEscape () {
373
- if (still == 1) {
374
- info.player2.changeScoreBy(1)
375
- }
376
- still = 1
377
- }
378
-
379
- }
380
-
381
- ```
382
283
 
383
284
 
384
285
  ```assetjson
@@ -80,9 +80,9 @@ myHammer = sprites.create(assets.image`hammer`, SpriteKind.Player)
80
80
  We need to be able to move the hammer around the screen to chase the mole.
81
81
 
82
82
 
83
- - :game: From the ``||controller: Controller||`` category, grab <br/>
83
+ - :game: From the ``||simplified: Simplified||`` category, grab <br/>
84
84
  ```block
85
- controller.moveOnlyOnscreenWithArrows(myHammer, controller.Speeds.Fast)
85
+ simplified.moveOnlyOnscreenWithArrows(myHammer, simplified.Speeds.Fast)
86
86
  ```
87
87
  and snap it in at **the end** of the ``||loops(noclick): on start||`` block already in the workspace.
88
88
 
@@ -107,7 +107,7 @@ scene.setBackgroundImage(assets.image`grid`)
107
107
  myMole = sprites.create(assets.image`mole`, SpriteKind.Enemy)
108
108
  myHammer = sprites.create(assets.image`hammer`, SpriteKind.Player)
109
109
  //@highlight
110
- controller.moveOnlyOnscreenWithArrows(myHammer, controller.Speeds.Fast)
110
+ simplified.moveOnlyOnscreenWithArrows(myHammer, simplified.Speeds.Fast)
111
111
  ```
112
112
 
113
113
 
@@ -178,10 +178,10 @@ When your rubber hammer overlaps the mole, you should see points start to show u
178
178
  Did you notice that the points added up really quickly when the rubber hammer stayed above the mole? Let's fix that.
179
179
 
180
180
 
181
- - :paper plane: From the ``||sprites: Sprites||`` category, grab <br/>
181
+ - :paper plane: From the ``||simplified: Simplified||`` category, grab <br/>
182
182
 
183
183
  ```block
184
- sprites.moveToRandomHoleOnGrid(myMole)
184
+ simplified.moveToRandomHoleOnGrid(myMole)
185
185
  ```
186
186
 
187
187
  and snap it into **the end** of the ``||sprites(noclick): on sprite overlaps otherSprite||`` block container already in the workspace.
@@ -204,7 +204,7 @@ hint~
204
204
  sprites.onOverlap(SpriteKind.Player, SpriteKind.Enemy, function (sprite, otherSprite) {
205
205
  info.changeScoreBy(1)
206
206
  //@highlight
207
- sprites.moveToRandomHoleOnGrid(myMole)
207
+ simplified.moveToRandomHoleOnGrid(myMole)
208
208
  })
209
209
  ```
210
210
 
@@ -244,7 +244,7 @@ let myHammer: Sprite = null
244
244
  scene.setBackgroundImage(assets.image`grid`)
245
245
  myMole = sprites.create(assets.image`mole`, SpriteKind.Enemy)
246
246
  myHammer = sprites.create(assets.image`hammer`, SpriteKind.Player)
247
- controller.moveOnlyOnscreenWithArrows(myHammer, controller.Speeds.Fast)
247
+ simplified.moveOnlyOnscreenWithArrows(myHammer, simplified.Speeds.Fast)
248
248
  //@highlight
249
249
  carnival.startCountdownGame(15, carnival.WinTypes.Score)
250
250
  ```
@@ -285,13 +285,15 @@ When you're ready, click **Done** to return to the skillmap so you can add sound
285
285
  let myHammer = sprites.create(img`.`, SpriteKind.Player)
286
286
  sprites.onOverlap(SpriteKind.Player, SpriteKind.Enemy, function (sprite, otherSprite) { info.changeScoreBy(1) })
287
287
  carnival.startCountdownGame(15, carnival.WinTypes.Score)
288
+ simplified.moveOnlyOnscreenWithArrows(myHammer, simplified.Speeds.Fast)
289
+ simplified.moveToRandomHoleOnGrid(myMole)
288
290
  ```
289
291
 
290
292
 
291
293
 
292
294
  ```package
293
- simple-blocks=github:microsoft/arcade-tutorial-extensions/simple-blocks
294
295
  carnival=github:microsoft/arcade-carnival
296
+ mole-images=github:kiki-lee/mole-images#v0.0.2
295
297
  ```
296
298
 
297
299
 
@@ -302,112 +304,33 @@ scene.setBackgroundImage(assets.image`grid`)
302
304
  myMole = sprites.create(assets.image`mole`, SpriteKind.Enemy)
303
305
 
304
306
  game.onUpdateInterval(1000, function () {
305
- sprites.moveToRandomHoleOnGrid(myMole)
307
+ simplified.moveToRandomHoleOnGrid(myMole)
306
308
  })
307
309
  ```
308
310
 
311
+ ```ghost
309
312
 
313
+ sprites.onOverlap(SpriteKind.Player, SpriteKind.Enemy, function (sprite, otherSprite) {
314
+ info.changeScoreBy(1)
315
+ simplified.moveToRandomHoleOnGrid(myMole)
310
316
 
311
- ```customts
312
-
313
- namespace controller{
314
-
315
- export enum Speeds {
316
- //% block="fast"
317
- Fast,
318
- //% block="medium"
319
- Med,
320
- //% block="slow"
321
- Slow
322
- }
323
-
324
-
325
- /**
326
- * Combines a simple "move with arrows"
327
- * and stay in screen
328
- */
329
- //% color="#d54322"
330
- //% blockId=move_only_onscreen_with_arrows
331
- //% block="move $thisSprite=variables_get(myHammer) on screen with speed $mySpeed"
332
- //% mySpeed.defl=Speeds.Fast
333
- //% inlineInputMode=inline
334
- export function moveOnlyOnscreenWithArrows(thisSprite: Sprite, mySpeed: Speeds) {
335
- thisSprite.setStayInScreen(true)
336
- if (mySpeed == Speeds.Fast) {
337
- controller.moveSprite(thisSprite, 225, 225)
338
- } else if (mySpeed == Speeds.Med) {
339
- controller.moveSprite(thisSprite, 175, 175)
340
- } else {
341
- controller.moveSprite(thisSprite, 100, 100)
342
- }
343
- }
344
-
345
- }
346
-
347
- namespace sprites {
348
-
349
- /**
350
- * Randomly moves mole to one of the holes on grid
351
- */
352
- //% color="#4b7bec"
353
- //% blockId=move_to_random_hole_on_grid
354
- //% block="move sprite $thisSprite=variables_get(myMole) to random area"
355
- //% inlineInputMode=inline
356
- export function moveToRandomHoleOnGrid(thisSprite: Sprite) {
357
- thisSprite.setPosition(simplified.chooseRandomNumber(28, 80, 130), simplified.chooseRandomNumber(21, 53, 85))
358
- simplified.still = 0;
359
- }
360
- }
361
-
362
-
363
- namespace simplified {
364
-
365
- export let still = 0;
366
-
367
- /**
368
- * Randomly chooses one of the parameter numbers
369
- *
370
- * @param choice1 Numeric choice to appear in the list of player choices
371
- * @param choice2 Numeric choice to appear in the list of player choices
372
- * @param choice3 Numeric choice to appear in the list of player choices
373
- * @param choice4 Numeric choice to appear in the list of player choices
374
- * @param choice5 Numeric choice to appear in the list of player choices
375
- */
376
-
377
- //% group=Arrays
378
- //% color="#fa8f08"
379
- //% blockId=choose_random_num_from_array
380
- //% block="choose one of $choice1 $choice2 $choice3 || $choice4 $choice5"
381
- //% choice1.defl=28
382
- //% choice2.defl=80
383
- //% choice3.defl=130
384
- //% inlineInputMode=inline
385
- export function chooseRandomNumber(choice1: number, choice2: number, choice3: number, choice4?: number, choice5?: number) {
386
- let myList = [choice1, choice2];
387
- if (choice3) myList.push(choice3);
388
- if (choice4) myList.push(choice4);
389
- if (choice5) myList.push(choice5);
390
- return myList._pickRandom();
391
- }
392
-
393
- /**
394
- * Checks to see if mole has been moved since last time position was checked
395
- */
396
-
397
- //% blockId=check_mole_escape
398
- //% block="check if mole has escaped"
399
- export function checkMoleEscape () {
400
- if (still == 1) {
401
- info.player2.changeScoreBy(1)
402
- }
403
- still = 1
404
- }
405
-
406
- }
317
+ })
318
+ let myMole: Sprite = null
319
+ let myHammer: Sprite = null
320
+ scene.setBackgroundImage(assets.image`grid`)
321
+ myMole = sprites.create(assets.image`mole`, SpriteKind.Enemy)
322
+ myHammer = sprites.create(assets.image`hammer`, SpriteKind.Player)
323
+ simplified.moveOnlyOnscreenWithArrows(myHammer, simplified.Speeds.Fast)
324
+ carnival.startCountdownGame(15, carnival.WinTypes.Score)
407
325
 
326
+ game.onUpdateInterval(1000, function () {
327
+ simplified.moveToRandomHoleOnGrid(myMole)
328
+ })
329
+ simplified.moveToRandomHoleOnGrid(myMole)
408
330
  ```
409
331
 
410
332
 
333
+
411
334
  ```assetjson
412
335
  {
413
336
  "README.md": " ",
@@ -72,7 +72,7 @@ let myHammer: Sprite = null
72
72
  scene.setBackgroundImage(assets.image`grid`)
73
73
  myMole = sprites.create(assets.image`mole`, SpriteKind.Enemy)
74
74
  myHammer = sprites.create(assets.image`hammer`, SpriteKind.Player)
75
- controller.moveOnlyOnscreenWithArrows(myHammer, controller.Speeds.Fast)
75
+ simplified.moveOnlyOnscreenWithArrows(myHammer, simplified.Speeds.Fast)
76
76
  carnival.startCountdownGame(15, carnival.WinTypes.Score)
77
77
  //@highlight
78
78
  carnival.addLabelTo("Whack-the-Mole", carnival.Areas.Bottom)
@@ -113,7 +113,7 @@ sprites.onOverlap(SpriteKind.Player, SpriteKind.Enemy, function (sprite, otherSp
113
113
  let myMole: Sprite = null
114
114
  let myHammer: Sprite = null
115
115
  info.changeScoreBy(1)
116
- sprites.moveToRandomHoleOnGrid(myMole)
116
+ simplified.moveToRandomHoleOnGrid(myMole)
117
117
  //@highlight
118
118
  music.knock.play()
119
119
 
@@ -184,7 +184,7 @@ sprites.onOverlap(SpriteKind.Player, SpriteKind.Enemy, function (sprite, otherSp
184
184
  let myMole: Sprite = null
185
185
  let myHammer: Sprite = null
186
186
  info.changeScoreBy(1)
187
- sprites.moveToRandomHoleOnGrid(myMole)
187
+ simplified.moveToRandomHoleOnGrid(myMole)
188
188
  music.knock.play()
189
189
  //@highlight
190
190
  animation.runImageAnimation(
@@ -237,14 +237,16 @@ myHammer = sprites.create(img`.`, SpriteKind.Player)
237
237
  sprites.onOverlap(SpriteKind.Player, SpriteKind.Enemy, function (sprite, otherSprite) { info.changeScoreBy(1) })
238
238
  carnival.addLabelTo("Whack-the-Mole", carnival.Areas.Bottom)
239
239
  carnival.startCountdownGame(15, carnival.WinTypes.Score)
240
+ simplified.moveOnlyOnscreenWithArrows(myHammer, simplified.Speeds.Fast)
241
+ simplified.moveToRandomHoleOnGrid(myMole)
240
242
 
241
243
  ```
242
244
 
243
245
 
244
246
 
245
247
  ```package
246
- simple-blocks=github:microsoft/arcade-tutorial-extensions/simple-blocks
247
248
  carnival=github:microsoft/arcade-carnival
249
+ mole-images=github:kiki-lee/mole-images#v0.0.2
248
250
  ```
249
251
 
250
252
 
@@ -252,7 +254,7 @@ carnival=github:microsoft/arcade-carnival
252
254
 
253
255
  sprites.onOverlap(SpriteKind.Player, SpriteKind.Enemy, function (sprite, otherSprite) {
254
256
  info.changeScoreBy(1)
255
- sprites.moveToRandomHoleOnGrid(myMole)
257
+ simplified.moveToRandomHoleOnGrid(myMole)
256
258
 
257
259
  })
258
260
  let myMole: Sprite = null
@@ -260,114 +262,16 @@ let myHammer: Sprite = null
260
262
  scene.setBackgroundImage(assets.image`grid`)
261
263
  myMole = sprites.create(assets.image`mole`, SpriteKind.Enemy)
262
264
  myHammer = sprites.create(assets.image`hammer`, SpriteKind.Player)
263
- controller.moveOnlyOnscreenWithArrows(myHammer, controller.Speeds.Fast)
265
+ simplified.moveOnlyOnscreenWithArrows(myHammer, simplified.Speeds.Fast)
264
266
  carnival.startCountdownGame(15, carnival.WinTypes.Score)
265
267
 
266
268
  game.onUpdateInterval(1000, function () {
267
- sprites.moveToRandomHoleOnGrid(myMole)
269
+ simplified.moveToRandomHoleOnGrid(myMole)
268
270
  })
269
271
 
270
272
  ```
271
273
 
272
274
 
273
- ```customts
274
-
275
- namespace controller{
276
-
277
- export enum Speeds {
278
- //% block="fast"
279
- Fast,
280
- //% block="medium"
281
- Med,
282
- //% block="slow"
283
- Slow
284
- }
285
-
286
-
287
- /**
288
- * Combines a simple "move with arrows"
289
- * and stay in screen
290
- */
291
- //% color="#d54322"
292
- //% blockId=move_only_onscreen_with_arrows
293
- //% block="move $thisSprite=variables_get(myHammer) on screen with speed $mySpeed"
294
- //% mySpeed.defl=Speeds.Fast
295
- //% inlineInputMode=inline
296
- export function moveOnlyOnscreenWithArrows(thisSprite: Sprite, mySpeed: Speeds) {
297
- thisSprite.setStayInScreen(true)
298
- if (mySpeed == Speeds.Fast) {
299
- controller.moveSprite(thisSprite, 225, 225)
300
- } else if (mySpeed == Speeds.Med) {
301
- controller.moveSprite(thisSprite, 175, 175)
302
- } else {
303
- controller.moveSprite(thisSprite, 100, 100)
304
- }
305
- }
306
-
307
- }
308
-
309
- namespace sprites {
310
-
311
- /**
312
- * Randomly moves mole to one of the holes on grid
313
- */
314
- //% color="#4b7bec"
315
- //% blockId=move_to_random_hole_on_grid
316
- //% block="move sprite $thisSprite=variables_get(myMole) to random area"
317
- //% inlineInputMode=inline
318
- export function moveToRandomHoleOnGrid(thisSprite: Sprite) {
319
- thisSprite.setPosition(simplified.chooseRandomNumber(28, 80, 130), simplified.chooseRandomNumber(21, 53, 85))
320
- simplified.still = 0;
321
- }
322
- }
323
-
324
-
325
- namespace simplified {
326
-
327
- export let still = 0;
328
-
329
- /**
330
- * Randomly chooses one of the parameter numbers
331
- *
332
- * @param choice1 Numeric choice to appear in the list of player choices
333
- * @param choice2 Numeric choice to appear in the list of player choices
334
- * @param choice3 Numeric choice to appear in the list of player choices
335
- * @param choice4 Numeric choice to appear in the list of player choices
336
- * @param choice5 Numeric choice to appear in the list of player choices
337
- */
338
-
339
- //% group=Arrays
340
- //% color="#fa8f08"
341
- //% blockId=choose_random_num_from_array
342
- //% block="choose one of $choice1 $choice2 $choice3 || $choice4 $choice5"
343
- //% choice1.defl=28
344
- //% choice2.defl=80
345
- //% choice3.defl=130
346
- //% inlineInputMode=inline
347
- export function chooseRandomNumber(choice1: number, choice2: number, choice3: number, choice4?: number, choice5?: number) {
348
- let myList = [choice1, choice2];
349
- if (choice3) myList.push(choice3);
350
- if (choice4) myList.push(choice4);
351
- if (choice5) myList.push(choice5);
352
- return myList._pickRandom();
353
- }
354
-
355
- /**
356
- * Checks to see if mole has been moved since last time position was checked
357
- */
358
-
359
- //% blockId=check_mole_escape
360
- //% block="check if mole has escaped"
361
- export function checkMoleEscape () {
362
- if (still == 1) {
363
- info.player2.changeScoreBy(1)
364
- }
365
- still = 1
366
- }
367
-
368
- }
369
-
370
- ```
371
275
 
372
276
 
373
277
  ```assetjson