pxt-common-packages 11.1.6 → 12.0.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 (44) hide show
  1. package/built/common-sim.js +4 -4
  2. package/libs/azureiot/built/debug/binary.js +461 -461
  3. package/libs/base/configkeys.h +1 -0
  4. package/libs/color/built/debug/binary.js +8 -8
  5. package/libs/color-sensor/built/debug/binary.js +8 -8
  6. package/libs/controller/built/debug/binary.js +7121 -7121
  7. package/libs/controller---none/built/debug/binary.js +7101 -7101
  8. package/libs/datalogger/built/debug/binary.js +63 -63
  9. package/libs/edge-connector/built/debug/binary.js +8 -8
  10. package/libs/esp32/built/debug/binary.js +462 -462
  11. package/libs/game/_locales/game-strings.json +1 -0
  12. package/libs/game/animation.ts +1 -0
  13. package/libs/game/assetTemplates.ts +4 -0
  14. package/libs/game/built/debug/binary.js +7040 -7040
  15. package/libs/game/docs/reference/controller/dy.md +2 -2
  16. package/libs/game/docs/reference/info/countdown.md +1 -7
  17. package/libs/game/docs/reference/scene/get-tile-location.md +1 -0
  18. package/libs/game/docs/reference/scene/tile-at-location-equals.md +1 -0
  19. package/libs/game/docs/reference/scene/tile-at-location-is-wall.md +1 -0
  20. package/libs/game/game.ts +11 -1
  21. package/libs/game/info.ts +7 -2
  22. package/libs/game/tilemap.ts +2 -0
  23. package/libs/lcd/built/debug/binary.js +8 -8
  24. package/libs/light-spectrum-sensor/built/debug/binary.js +8 -8
  25. package/libs/lora/built/debug/binary.js +8 -8
  26. package/libs/matrix-keypad/built/debug/binary.js +8 -8
  27. package/libs/mixer/sim/music.ts +4 -4
  28. package/libs/mqtt/built/debug/binary.js +176 -176
  29. package/libs/net/built/debug/binary.js +176 -176
  30. package/libs/net-game/built/debug/binary.js +8629 -8629
  31. package/libs/palette/built/debug/binary.js +7039 -7039
  32. package/libs/pixel/built/debug/binary.js +8 -8
  33. package/libs/power/built/debug/binary.js +8 -8
  34. package/libs/proximity/built/debug/binary.js +8 -8
  35. package/libs/radio/built/debug/binary.js +8 -8
  36. package/libs/radio-broadcast/built/debug/binary.js +8 -8
  37. package/libs/rotary-encoder/built/debug/binary.js +8 -8
  38. package/libs/screen/built/debug/binary.js +50 -50
  39. package/libs/servo/built/debug/binary.js +8 -8
  40. package/libs/servo/docs/reference/servos/set-pulse.md +1 -1
  41. package/libs/settings/settings.cpp +5 -0
  42. package/libs/sprite-scaling/built/debug/binary.js +7039 -7039
  43. package/libs/storyboard/built/debug/binary.js +7039 -7039
  44. package/package.json +2 -2
@@ -1,9 +1,9 @@
1
- # dx
1
+ # dy
2
2
 
3
3
  Gets the amount of vertical movement to use if an up or down key is pressed.
4
4
 
5
5
  ```sig
6
- controller.dx(0)
6
+ controller.dy(0)
7
7
  ```
8
8
 
9
9
  If you're controlling the location of a sprite by key pressess, you can decide how much change in position it will have when a key is pressed. This is done with _steps_. While a direction key is pressed, the movement value returned is based on if and how long the key is pressed, along with the step size you gave it. If you want fast movement, then you use a larger step size.
@@ -3,15 +3,9 @@
3
3
  Get the current game countdown time.
4
4
 
5
5
  ```sig
6
- info.changeCountdownBy(0)
6
+ info.countdown()
7
7
  ```
8
8
 
9
- The current game countdown time amount is increased by adding the change value when it is greater than zero (positive). If the change number is less than zero (negative), the game countdown is reduced by the value of the change number.
10
-
11
- ## Parameters
12
-
13
- * **value**: a [number](/types/number) to set the game countdown by.
14
-
15
9
  ## Returns
16
10
 
17
11
  * a [number](/types/number) that is the amount of time remaining for the game countdown in seconds.
@@ -50,6 +50,7 @@ forever(function () {
50
50
 
51
51
  ## See also #seealso
52
52
 
53
+ [location](/reference/scene/location),
53
54
  [set tile at](/reference/scene/set-tile-at),
54
55
  [place on tile](/reference/scene/place-on-tile)
55
56
 
@@ -56,6 +56,7 @@ mySprite.vy = 35
56
56
 
57
57
  ## See also #seealso
58
58
 
59
+ [location](/reference/scene/location),
59
60
  [get tile location](/reference/scene/get-tile-location)
60
61
 
61
62
  ```jres
@@ -64,6 +64,7 @@ mySprite.vx = 30
64
64
 
65
65
  ## See also #seealso
66
66
 
67
+ [location](/reference/scene/location),
67
68
  [get tile location](/reference/scene/get-tile-location)
68
69
 
69
70
  ```jres
package/libs/game/game.ts CHANGED
@@ -372,6 +372,15 @@ namespace game {
372
372
  _gameOverImpl(true, player);
373
373
  }
374
374
 
375
+ function _mapScoreTypeToString(scoreType: ScoringType): string {
376
+ switch (scoreType) {
377
+ case ScoringType.HighScore: return "highscore";
378
+ case ScoringType.LowScore: return "lowscore";
379
+ case ScoringType.None: return "none";
380
+ default: return "none";
381
+ }
382
+ }
383
+
375
384
  function _gameOverImpl(win: boolean, winnerOverride?: number) {
376
385
  init();
377
386
  if (__isOver) return;
@@ -389,7 +398,8 @@ namespace game {
389
398
  const scores = playersWithScores.map(player => new GameOverPlayerScore(player.number, player.impl.score(), player === winner));
390
399
 
391
400
  // Save all scores. Dependency Note: this action triggers Kiosk to exit the simulator and show the high score screen.
392
- info.saveAllScores();
401
+ const scoreTypeString = _mapScoreTypeToString(goc.scoringType);
402
+ info.saveAllScores(scoreTypeString);
393
403
 
394
404
  // Save high score if this was a judged game and there was a winner (don't save in the LOSE case).
395
405
  if (judged && winner) {
package/libs/game/info.ts CHANGED
@@ -241,7 +241,7 @@ namespace info {
241
241
  return players ? players.filter(item => item.impl.hasScore()) : [];
242
242
  }
243
243
 
244
- export function saveAllScores() {
244
+ export function saveAllScores(scoringType: string) {
245
245
  const allScoresKey = "all-scores";
246
246
  let allScores: number[];
247
247
  const pws = playersWithScores();
@@ -252,7 +252,12 @@ namespace info {
252
252
  allScores = [];
253
253
  }
254
254
 
255
- settings.writeJSON(allScoresKey, allScores);
255
+ const scoresObj = {
256
+ "allScores": allScores,
257
+ "scoringType": allScores.length ? scoringType : "None"
258
+ }
259
+
260
+ settings.writeJSON(allScoresKey, scoresObj);
256
261
  }
257
262
 
258
263
  export function winningPlayer(): PlayerInfo {
@@ -1,4 +1,6 @@
1
1
  enum TileScale {
2
+ //% block="4x4"
3
+ Four = 2,
2
4
  //% block="8x8"
3
5
  Eight = 3,
4
6
  //% block="16x16"
@@ -56,7 +56,7 @@ const pxsim_pxtrt = pxsim.pxtrt;
56
56
  const pxsim_numops = pxsim.numops;
57
57
 
58
58
 
59
- function _main___P48910(s) {
59
+ function _main___P48913(s) {
60
60
  let r0 = s.r0, step = s.pc;
61
61
  s.pc = -1;
62
62
 
@@ -66,19 +66,19 @@ if (yieldSteps-- < 0 && maybeYield(s, step, r0) || runtime !== pxsim.runtime) re
66
66
  switch (step) {
67
67
  case 0:
68
68
 
69
- globals._intervals___49153 = (undefined);
70
- globals._pollEventQueue___49166 = (undefined);
69
+ globals._intervals___49156 = (undefined);
70
+ globals._pollEventQueue___49169 = (undefined);
71
71
  r0 = undefined;
72
72
  return leave(s, r0)
73
73
  default: oops()
74
74
  } } }
75
- _main___P48910.info = {"start":0,"length":0,"line":0,"column":0,"endLine":0,"endColumn":0,"fileName":"characterlcd.ts","functionName":"<main>","argumentNames":[]}
76
- _main___P48910.continuations = [ ]
75
+ _main___P48913.info = {"start":0,"length":0,"line":0,"column":0,"endLine":0,"endColumn":0,"fileName":"characterlcd.ts","functionName":"<main>","argumentNames":[]}
76
+ _main___P48913.continuations = [ ]
77
77
 
78
- function _main___P48910_mk(s) {
78
+ function _main___P48913_mk(s) {
79
79
  checkStack(s.depth);
80
80
  return {
81
- parent: s, fn: _main___P48910, depth: s.depth + 1,
81
+ parent: s, fn: _main___P48913, depth: s.depth + 1,
82
82
  pc: 0, retval: undefined, r0: undefined, overwrittenPC: false, lambdaArgs: null,
83
83
  } }
84
84
 
@@ -88,5 +88,5 @@ function _main___P48910_mk(s) {
88
88
 
89
89
  const breakpoints = setupDebugger(1, [])
90
90
 
91
- return _main___P48910
91
+ return _main___P48913
92
92
  })
@@ -56,7 +56,7 @@ const pxsim_pxtrt = pxsim.pxtrt;
56
56
  const pxsim_numops = pxsim.numops;
57
57
 
58
58
 
59
- function _main___P99068(s) {
59
+ function _main___P99077(s) {
60
60
  let r0 = s.r0, step = s.pc;
61
61
  s.pc = -1;
62
62
 
@@ -66,19 +66,19 @@ if (yieldSteps-- < 0 && maybeYield(s, step, r0) || runtime !== pxsim.runtime) re
66
66
  switch (step) {
67
67
  case 0:
68
68
 
69
- globals._intervals___99311 = (undefined);
70
- globals._pollEventQueue___99324 = (undefined);
69
+ globals._intervals___99320 = (undefined);
70
+ globals._pollEventQueue___99333 = (undefined);
71
71
  r0 = undefined;
72
72
  return leave(s, r0)
73
73
  default: oops()
74
74
  } } }
75
- _main___P99068.info = {"start":0,"length":0,"line":0,"column":0,"endLine":0,"endColumn":0,"fileName":"tsl2591.ts","functionName":"<main>","argumentNames":[]}
76
- _main___P99068.continuations = [ ]
75
+ _main___P99077.info = {"start":0,"length":0,"line":0,"column":0,"endLine":0,"endColumn":0,"fileName":"tsl2591.ts","functionName":"<main>","argumentNames":[]}
76
+ _main___P99077.continuations = [ ]
77
77
 
78
- function _main___P99068_mk(s) {
78
+ function _main___P99077_mk(s) {
79
79
  checkStack(s.depth);
80
80
  return {
81
- parent: s, fn: _main___P99068, depth: s.depth + 1,
81
+ parent: s, fn: _main___P99077, depth: s.depth + 1,
82
82
  pc: 0, retval: undefined, r0: undefined, overwrittenPC: false, lambdaArgs: null,
83
83
  } }
84
84
 
@@ -88,5 +88,5 @@ function _main___P99068_mk(s) {
88
88
 
89
89
  const breakpoints = setupDebugger(1, [])
90
90
 
91
- return _main___P99068
91
+ return _main___P99077
92
92
  })
@@ -56,7 +56,7 @@ const pxsim_pxtrt = pxsim.pxtrt;
56
56
  const pxsim_numops = pxsim.numops;
57
57
 
58
58
 
59
- function _main___P60218(s) {
59
+ function _main___P60221(s) {
60
60
  let r0 = s.r0, step = s.pc;
61
61
  s.pc = -1;
62
62
 
@@ -66,19 +66,19 @@ if (yieldSteps-- < 0 && maybeYield(s, step, r0) || runtime !== pxsim.runtime) re
66
66
  switch (step) {
67
67
  case 0:
68
68
 
69
- globals._intervals___60461 = (undefined);
70
- globals._pollEventQueue___60474 = (undefined);
69
+ globals._intervals___60464 = (undefined);
70
+ globals._pollEventQueue___60477 = (undefined);
71
71
  r0 = undefined;
72
72
  return leave(s, r0)
73
73
  default: oops()
74
74
  } } }
75
- _main___P60218.info = {"start":0,"length":0,"line":0,"column":0,"endLine":0,"endColumn":0,"fileName":"lora.ts","functionName":"<main>","argumentNames":[]}
76
- _main___P60218.continuations = [ ]
75
+ _main___P60221.info = {"start":0,"length":0,"line":0,"column":0,"endLine":0,"endColumn":0,"fileName":"lora.ts","functionName":"<main>","argumentNames":[]}
76
+ _main___P60221.continuations = [ ]
77
77
 
78
- function _main___P60218_mk(s) {
78
+ function _main___P60221_mk(s) {
79
79
  checkStack(s.depth);
80
80
  return {
81
- parent: s, fn: _main___P60218, depth: s.depth + 1,
81
+ parent: s, fn: _main___P60221, depth: s.depth + 1,
82
82
  pc: 0, retval: undefined, r0: undefined, overwrittenPC: false, lambdaArgs: null,
83
83
  } }
84
84
 
@@ -88,5 +88,5 @@ function _main___P60218_mk(s) {
88
88
 
89
89
  const breakpoints = setupDebugger(1, [])
90
90
 
91
- return _main___P60218
91
+ return _main___P60221
92
92
  })
@@ -56,7 +56,7 @@ const pxsim_pxtrt = pxsim.pxtrt;
56
56
  const pxsim_numops = pxsim.numops;
57
57
 
58
58
 
59
- function _main___P192896(s) {
59
+ function _main___P192917(s) {
60
60
  let r0 = s.r0, step = s.pc;
61
61
  s.pc = -1;
62
62
 
@@ -66,19 +66,19 @@ if (yieldSteps-- < 0 && maybeYield(s, step, r0) || runtime !== pxsim.runtime) re
66
66
  switch (step) {
67
67
  case 0:
68
68
 
69
- globals._intervals___193139 = (undefined);
70
- globals._pollEventQueue___193152 = (undefined);
69
+ globals._intervals___193160 = (undefined);
70
+ globals._pollEventQueue___193173 = (undefined);
71
71
  r0 = undefined;
72
72
  return leave(s, r0)
73
73
  default: oops()
74
74
  } } }
75
- _main___P192896.info = {"start":0,"length":0,"line":0,"column":0,"endLine":0,"endColumn":0,"fileName":"keypad.ts","functionName":"<main>","argumentNames":[]}
76
- _main___P192896.continuations = [ ]
75
+ _main___P192917.info = {"start":0,"length":0,"line":0,"column":0,"endLine":0,"endColumn":0,"fileName":"keypad.ts","functionName":"<main>","argumentNames":[]}
76
+ _main___P192917.continuations = [ ]
77
77
 
78
- function _main___P192896_mk(s) {
78
+ function _main___P192917_mk(s) {
79
79
  checkStack(s.depth);
80
80
  return {
81
- parent: s, fn: _main___P192896, depth: s.depth + 1,
81
+ parent: s, fn: _main___P192917, depth: s.depth + 1,
82
82
  pc: 0, retval: undefined, r0: undefined, overwrittenPC: false, lambdaArgs: null,
83
83
  } }
84
84
 
@@ -88,5 +88,5 @@ function _main___P192896_mk(s) {
88
88
 
89
89
  const breakpoints = setupDebugger(1, [])
90
90
 
91
- return _main___P192896
91
+ return _main___P192917
92
92
  })
@@ -54,16 +54,16 @@ namespace pxsim.music {
54
54
 
55
55
  await res.sequencer.initAsync();
56
56
  res.sequencer.addEventListener("stop", () => {
57
- board().bus.queue(SEQUENCER_STOP_MESSAGE, this.id);
57
+ board().bus.queue(SEQUENCER_STOP_MESSAGE, res.id);
58
58
  });
59
59
  res.sequencer.addEventListener("state-change", () => {
60
- board().bus.queue(SEQUENCER_STATE_CHANGE_MESSAGE, this.id);
60
+ board().bus.queue(SEQUENCER_STATE_CHANGE_MESSAGE, res.id);
61
61
  });
62
62
  res.sequencer.addEventListener("looped", () => {
63
- board().bus.queue(SEQUENCER_LOOPED_MESSAGE, this.id);
63
+ board().bus.queue(SEQUENCER_LOOPED_MESSAGE, res.id);
64
64
  });
65
65
  res.sequencer.addEventListener("tick", () => {
66
- board().bus.queue(SEQUENCER_TICK_MESSAGE, this.id);
66
+ board().bus.queue(SEQUENCER_TICK_MESSAGE, res.id);
67
67
  });
68
68
 
69
69