pxt-common-packages 10.4.5 → 10.4.6

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 (53) hide show
  1. package/built/common-sim.d.ts +4 -0
  2. package/built/common-sim.js +187 -0
  3. package/libs/azureiot/built/debug/binary.js +461 -461
  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 +7118 -7118
  7. package/libs/controller---none/built/debug/binary.js +7094 -7094
  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-jsdoc-strings.json +1 -0
  12. package/libs/game/built/debug/binary.js +7037 -7037
  13. package/libs/game/docs/reference/game/set-game-over-effect.md +47 -0
  14. package/libs/game/docs/reference/game/set-game-over-message.md +47 -0
  15. package/libs/game/docs/reference/game/set-game-over-playable.md +48 -0
  16. package/libs/game/docs/reference/game/set-game-over-scoring-type.md +78 -0
  17. package/libs/game/docs/reference/game.md +8 -0
  18. package/libs/game/game.ts +24 -0
  19. package/libs/game/info.ts +18 -8
  20. package/libs/lcd/built/debug/binary.js +8 -8
  21. package/libs/light-spectrum-sensor/built/debug/binary.js +8 -8
  22. package/libs/lora/built/debug/binary.js +8 -8
  23. package/libs/matrix-keypad/built/debug/binary.js +8 -8
  24. package/libs/mixer/docs/reference/music/create-song.md +38 -0
  25. package/libs/mixer/docs/reference/music/melody-playable.md +30 -0
  26. package/libs/mixer/docs/reference/music/play.md +132 -0
  27. package/libs/mixer/docs/reference/music/song-editor.md +92 -0
  28. package/libs/mixer/docs/reference/music/string-playable.md +41 -0
  29. package/libs/mixer/docs/reference/music/tone-playable.md +30 -0
  30. package/libs/mixer/docs/reference/music.md +12 -7
  31. package/libs/mixer/docs/types/playable.md +76 -0
  32. package/libs/mixer/melody.ts +1 -0
  33. package/libs/mixer/playable.ts +4 -0
  34. package/libs/mqtt/built/debug/binary.js +176 -176
  35. package/libs/multiplayer/player.ts +1 -0
  36. package/libs/net/built/debug/binary.js +176 -176
  37. package/libs/net-game/built/debug/binary.js +8626 -8626
  38. package/libs/palette/built/debug/binary.js +7036 -7036
  39. package/libs/pixel/built/debug/binary.js +8 -8
  40. package/libs/power/built/debug/binary.js +8 -8
  41. package/libs/proximity/built/debug/binary.js +8 -8
  42. package/libs/radio/built/debug/binary.js +8 -8
  43. package/libs/radio-broadcast/built/debug/binary.js +8 -8
  44. package/libs/rotary-encoder/built/debug/binary.js +8 -8
  45. package/libs/screen/_locales/screen-jsdoc-strings.json +2 -0
  46. package/libs/screen/built/debug/binary.js +50 -50
  47. package/libs/screen/image.cpp +226 -0
  48. package/libs/screen/image.ts +44 -0
  49. package/libs/screen/sim/image.ts +240 -0
  50. package/libs/servo/built/debug/binary.js +8 -8
  51. package/libs/sprite-scaling/built/debug/binary.js +7036 -7036
  52. package/libs/storyboard/built/debug/binary.js +7036 -7036
  53. package/package.json +1 -1
@@ -0,0 +1,47 @@
1
+ # set Game Over Effect
2
+
3
+ Set an effect to display when the game is over.
4
+
5
+ ```sig
6
+ game.setGameOverEffect(true, effects.confetti)
7
+ ```
8
+
9
+ ## Parameters
10
+
11
+ * **win**: a [boolean](/types/boolean) value set to `true` to start the effect if the player wins the game. Set to `false` to start the effect if the player loses.
12
+ * **effect**: the effect to display when the game is over, such as `confettti`, `hearts`, or `smiles`.
13
+
14
+ ## Example #example
15
+
16
+ Make the game over when the kitten sprite touches the left of the screen. Show the splatter effect when the game is over.
17
+
18
+ ```blocks
19
+ game.setGameOverEffect(true, effects.splatter)
20
+ let mySprite = sprites.create(img`
21
+ . . . . . . . . . . . . . .
22
+ e e e . . . . e e e . . . .
23
+ c d d c . . c d d c . . . .
24
+ c b d d f f d d b c . . . .
25
+ c 3 b d d b d b 3 c . . . .
26
+ f b 3 d d d d 3 b f . . . .
27
+ e d d d d d d d d e . . . .
28
+ e d f d d d d f d e . b f b
29
+ f d d f d d f d d f . f d f
30
+ f b d d b b d d 2 b f f d f
31
+ . f 2 2 2 2 2 2 d b b d b f
32
+ . f d d d d d d d f f f f .
33
+ . . f d b d f d f . . . . .
34
+ . . . f f f f f f . . . . .
35
+ `, SpriteKind.Player)
36
+ mySprite.vx = -20
37
+ game.onUpdateInterval(500, function () {
38
+ if (mySprite.left < 0) {
39
+ game.gameOver(true)
40
+ }
41
+ })
42
+ ```
43
+
44
+ ## See also #seealso
45
+
46
+ [set game over message](/reference/game/set-game-over-message),
47
+ [set game over playable](/reference/game/set-game-over-playable)
@@ -0,0 +1,47 @@
1
+ # set Game Over Message
2
+
3
+ Set a message to display when the game is over.
4
+
5
+ ```sig
6
+ game.setGameOverMessage(true, "GAME OVER!")
7
+ ```
8
+
9
+ ## Parameters
10
+
11
+ * **win**: a [boolean](/types/boolean) value set to `true` to start the **sound** if the player wins the game. Set to `false` to start the **sound** if the player loses.
12
+ * **message**: a message [string](/types/string) to show when the game is over.
13
+
14
+ ## Example #example
15
+
16
+ Make the game over when the kitten sprite touches the left of the screen. Show a message when the player wins the game.
17
+
18
+ ```blocks
19
+ game.setGameOverMessage(true, "Yeah, you WIN!")
20
+ let mySprite = sprites.create(img`
21
+ . . . . . . . . . . . . . .
22
+ e e e . . . . e e e . . . .
23
+ c d d c . . c d d c . . . .
24
+ c b d d f f d d b c . . . .
25
+ c 3 b d d b d b 3 c . . . .
26
+ f b 3 d d d d 3 b f . . . .
27
+ e d d d d d d d d e . . . .
28
+ e d f d d d d f d e . b f b
29
+ f d d f d d f d d f . f d f
30
+ f b d d b b d d 2 b f f d f
31
+ . f 2 2 2 2 2 2 d b b d b f
32
+ . f d d d d d d d f f f f .
33
+ . . f d b d f d f . . . . .
34
+ . . . f f f f f f . . . . .
35
+ `, SpriteKind.Player)
36
+ mySprite.vx = -20
37
+ game.onUpdateInterval(500, function () {
38
+ if (mySprite.left < 0) {
39
+ game.gameOver(true)
40
+ }
41
+ })
42
+ ```
43
+
44
+ ## See also #seealso
45
+
46
+ [set game over effect](/reference/game/set-game-over-effect),
47
+ [set game over playabe](/reference/game/set-game-over-playable)
@@ -0,0 +1,48 @@
1
+ # set Game Over Playable
2
+
3
+ Set a sound to play when the game is over.
4
+
5
+ ```sig
6
+ game.setGameOverPlayable(true, music.melodyPlayable(music.powerUp), false)
7
+ ```
8
+
9
+ ## Parameters
10
+
11
+ * **win**: a [boolean](/types/boolean) value set to `true` to start the **sound** if the player wins the game. Set to `false` to start the **sound** if the player loses.
12
+ * **sound**: the sound to play when the game is over, such as `ba ding`, `siren`, or `buzzer`.
13
+ * **looping**: loop the **sound** when set to `true`. Play the **sound** only once if `false`.
14
+
15
+ ## Example #example
16
+
17
+ Make the game over when the kitten sprite touches the left of the screen. Play the `siren` sound when the player wins the game.
18
+
19
+ ```blocks
20
+ game.setGameOverPlayable(true, music.melodyPlayable(music.siren), false)
21
+ let mySprite = sprites.create(img`
22
+ . . . . . . . . . . . . . .
23
+ e e e . . . . e e e . . . .
24
+ c d d c . . c d d c . . . .
25
+ c b d d f f d d b c . . . .
26
+ c 3 b d d b d b 3 c . . . .
27
+ f b 3 d d d d 3 b f . . . .
28
+ e d d d d d d d d e . . . .
29
+ e d f d d d d f d e . b f b
30
+ f d d f d d f d d f . f d f
31
+ f b d d b b d d 2 b f f d f
32
+ . f 2 2 2 2 2 2 d b b d b f
33
+ . f d d d d d d d f f f f .
34
+ . . f d b d f d f . . . . .
35
+ . . . f f f f f f . . . . .
36
+ `, SpriteKind.Player)
37
+ mySprite.vx = -20
38
+ game.onUpdateInterval(500, function () {
39
+ if (mySprite.left < 0) {
40
+ game.gameOver(true)
41
+ }
42
+ })
43
+ ```
44
+
45
+ ## See also #seealso
46
+
47
+ [set game over effect](/reference/game/set-game-over-effect),
48
+ [set game over message](/reference/game/set-game-over-message)
@@ -0,0 +1,78 @@
1
+ # set Game Over Scoring Type
2
+
3
+ Set the scoring type to decide the best game score for multiple games.
4
+
5
+ ```sig
6
+ game.setGameOverScoringType(game.ScoringType.HighScore)
7
+ ```
8
+
9
+ When mulitple games are played with your game program, you can set the method to record the best game score. You can use the highest score, lowest score, or no score as the best game score.
10
+
11
+ ## Parameters
12
+
13
+ * **type**: the type of score used to record the best game score for multiple games:
14
+ >* `highest`: use the highest score as the best game score.
15
+ >* `lowest`: use the lowest score as the best game score.
16
+ >* `none`: don't record any score as the best score.
17
+
18
+ ## Example #example
19
+
20
+ Set the best score type to `lowest`. Move the player sprite up or down to avoid the projectiles. If your player is hit by projectiles, your score is increased. The lowest score is recorded for all of the games you play.
21
+
22
+ ```blocks
23
+ info.onCountdownEnd(function () {
24
+ game.gameOver(true)
25
+ })
26
+ sprites.onOverlap(SpriteKind.Player, SpriteKind.Projectile, function (sprite, otherSprite) {
27
+ info.changeScoreBy(1)
28
+ })
29
+ let projectile: Sprite = null
30
+ game.setGameOverScoringType(game.ScoringType.LowScore)
31
+ let mySprite = sprites.create(img`
32
+ . . . . . . . . . . b 5 b . . .
33
+ . . . . . . . . . b 5 b . . . .
34
+ . . . . . . . . . b c . . . . .
35
+ . . . . . . b b b b b b . . . .
36
+ . . . . . b b 5 5 5 5 5 b . . .
37
+ . . . . b b 5 d 1 f 5 5 d f . .
38
+ . . . . b 5 5 1 f f 5 d 4 c . .
39
+ . . . . b 5 5 d f b d d 4 4 . .
40
+ b d d d b b d 5 5 5 4 4 4 4 4 b
41
+ b b d 5 5 5 b 5 5 4 4 4 4 4 b .
42
+ b d c 5 5 5 5 d 5 5 5 5 5 b . .
43
+ c d d c d 5 5 b 5 5 5 5 5 5 b .
44
+ c b d d c c b 5 5 5 5 5 5 5 b .
45
+ . c d d d d d d 5 5 5 5 5 d b .
46
+ . . c b d d d d d 5 5 5 b b . .
47
+ . . . c c c c c c c c b b . . .
48
+ `, SpriteKind.Player)
49
+ mySprite.left = 10
50
+ controller.moveSprite(mySprite, 0, 100)
51
+ info.startCountdown(10)
52
+ game.onUpdateInterval(500, function () {
53
+ projectile = sprites.createProjectileFromSide(img`
54
+ . . . . . . . . . . . . . . . .
55
+ . . . . . . . . . . . . . . . .
56
+ . . . . . . . . . . . . . . . .
57
+ . . . . . . . . . . . . . . . .
58
+ . . . . . . . . . . . . . . . .
59
+ . . . . . . . 2 2 . . . . . . .
60
+ . . . . . . 3 1 1 3 . . . . . .
61
+ . . . . . 2 1 1 1 1 2 . . . . .
62
+ . . . . . 2 1 1 1 1 2 . . . . .
63
+ . . . . . . 3 1 1 3 . . . . . .
64
+ . . . . . . . 2 2 . . . . . . .
65
+ . . . . . . . . . . . . . . . .
66
+ . . . . . . . . . . . . . . . .
67
+ . . . . . . . . . . . . . . . .
68
+ . . . . . . . . . . . . . . . .
69
+ . . . . . . . . . . . . . . . .
70
+ `, -60, randint(-30, 30))
71
+ })
72
+ ```
73
+
74
+ ## See also #seealso
75
+
76
+ [set game over effect](/reference/game/set-game-over-effect),
77
+ [set game over playable](/reference/game/set-game-over-playable),
78
+ [set game over message](/reference/game/set-game-over-message)
@@ -4,6 +4,10 @@ Game control and text display actions.
4
4
 
5
5
  ```cards
6
6
  game.over()
7
+ game.setGameOverEffect(true, effects.confetti)
8
+ game.setGameOverMessage(true, "GAME OVER!")
9
+ game.setGameOverPlayable(true, music.melodyPlayable(music.powerUp), false)
10
+ game.setGameOverScoringType(game.ScoringType.HighScore)
7
11
  game.onUpdate(function () {})
8
12
  game.onUpdateInterval(500, function () {})
9
13
  game.ask("")
@@ -20,6 +24,10 @@ game.showLongText("", DialogLayout.Bottom)
20
24
  ## See also #seealso
21
25
 
22
26
  [over](/reference/game/over),
27
+ [set game over effect](/reference/game/set-game-over-effect),
28
+ [set game over message](/reference/game/set-game-over-message),
29
+ [set game over playable](/reference/game/set-game-over-playable),
30
+ [set game over scoring type](/reference/game/set-game-over-scoring-type),
23
31
  [on update](/reference/game/on-update),
24
32
  [on update interval](/reference/game/on-update-interval),
25
33
  [ask](/reference/game/ask),
package/libs/game/game.ts CHANGED
@@ -17,6 +17,30 @@ namespace game {
17
17
  None
18
18
  }
19
19
 
20
+ // To stay synchronized with https://github.com/microsoft/pxt/blob/stable8.5/webapp/src/components/ImageEditor/sprite/Palette.tsx#L98.
21
+ /**
22
+ * The available colors for Arcade.
23
+ * NOTE: If the color palette is changed, these values will change along with it.
24
+ **/
25
+ export enum Color {
26
+ Transparent = 0,
27
+ White = 1,
28
+ Red = 2,
29
+ Pink = 3,
30
+ Orange = 4,
31
+ Yellow = 5,
32
+ Teal = 6,
33
+ Green = 7,
34
+ Blue = 8,
35
+ LightBlue = 9,
36
+ Purple = 0xa,
37
+ LightPurple = 0xb,
38
+ DarkPurple = 0xc,
39
+ Tan = 0xd,
40
+ Brown = 0xe,
41
+ Black = 0xf
42
+ }
43
+
20
44
  export class GameOverConfig {
21
45
  scoringType: ScoringType;
22
46
  winEffect: effects.BackgroundEffect;
package/libs/game/info.ts CHANGED
@@ -33,7 +33,7 @@ namespace info {
33
33
  // null: reached 0 and callback was invoked
34
34
  public life: number;
35
35
  public lifeZeroHandler: () => void;
36
- public scoreReachedHandler: ScoreReachedHandler
36
+ public scoreReachedHandlers: ScoreReachedHandler[];
37
37
 
38
38
  public showScore?: boolean;
39
39
  public showLife?: boolean;
@@ -45,6 +45,7 @@ namespace info {
45
45
  this.showScore = undefined;
46
46
  this.showLife = undefined;
47
47
  this.showPlayer = undefined;
48
+ this.scoreReachedHandlers = [];
48
49
  }
49
50
  }
50
51
 
@@ -711,12 +712,12 @@ namespace info {
711
712
  const oldScore = state.score || 0;
712
713
  state.score = (value | 0);
713
714
 
714
- if (state.scoreReachedHandler && (
715
- (oldScore < state.scoreReachedHandler.score && state.score >= state.scoreReachedHandler.score) ||
716
- (oldScore > state.scoreReachedHandler.score && state.score <= state.scoreReachedHandler.score)
717
- )) {
718
- state.scoreReachedHandler.handler();
719
- }
715
+ state.scoreReachedHandlers.forEach(srh => {
716
+ if ((oldScore < srh.score && state.score >= srh.score) ||
717
+ (oldScore > srh.score && state.score <= srh.score)) {
718
+ srh.handler();
719
+ }
720
+ });
720
721
  }
721
722
 
722
723
  changeScoreBy(value: number): void {
@@ -766,7 +767,16 @@ namespace info {
766
767
 
767
768
  onScore(score: number, handler: () => void) {
768
769
  const state = this.getState();
769
- state.scoreReachedHandler = new ScoreReachedHandler(score, handler);
770
+
771
+ for (const element of state.scoreReachedHandlers) {
772
+ if (element.score === score) {
773
+ // Score handlers are implemented as "last one wins."
774
+ element.handler = handler;
775
+ return;
776
+ }
777
+ }
778
+
779
+ state.scoreReachedHandlers.push(new ScoreReachedHandler(score, handler));
770
780
  }
771
781
 
772
782
  raiseLifeZero(gameOver: boolean) {
@@ -56,7 +56,7 @@ const pxsim_pxtrt = pxsim.pxtrt;
56
56
  const pxsim_numops = pxsim.numops;
57
57
 
58
58
 
59
- function _main___P48860(s) {
59
+ function _main___P48883(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___49103 = (undefined);
70
- globals._pollEventQueue___49116 = (undefined);
69
+ globals._intervals___49126 = (undefined);
70
+ globals._pollEventQueue___49139 = (undefined);
71
71
  r0 = undefined;
72
72
  return leave(s, r0)
73
73
  default: oops()
74
74
  } } }
75
- _main___P48860.info = {"start":0,"length":0,"line":0,"column":0,"endLine":0,"endColumn":0,"fileName":"characterlcd.ts","functionName":"<main>","argumentNames":[]}
76
- _main___P48860.continuations = [ ]
75
+ _main___P48883.info = {"start":0,"length":0,"line":0,"column":0,"endLine":0,"endColumn":0,"fileName":"characterlcd.ts","functionName":"<main>","argumentNames":[]}
76
+ _main___P48883.continuations = [ ]
77
77
 
78
- function _main___P48860_mk(s) {
78
+ function _main___P48883_mk(s) {
79
79
  checkStack(s.depth);
80
80
  return {
81
- parent: s, fn: _main___P48860, depth: s.depth + 1,
81
+ parent: s, fn: _main___P48883, 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___P48860_mk(s) {
88
88
 
89
89
  const breakpoints = setupDebugger(1, [])
90
90
 
91
- return _main___P48860
91
+ return _main___P48883
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___P98912(s) {
59
+ function _main___P98987(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___99155 = (undefined);
70
- globals._pollEventQueue___99168 = (undefined);
69
+ globals._intervals___99230 = (undefined);
70
+ globals._pollEventQueue___99243 = (undefined);
71
71
  r0 = undefined;
72
72
  return leave(s, r0)
73
73
  default: oops()
74
74
  } } }
75
- _main___P98912.info = {"start":0,"length":0,"line":0,"column":0,"endLine":0,"endColumn":0,"fileName":"tsl2591.ts","functionName":"<main>","argumentNames":[]}
76
- _main___P98912.continuations = [ ]
75
+ _main___P98987.info = {"start":0,"length":0,"line":0,"column":0,"endLine":0,"endColumn":0,"fileName":"tsl2591.ts","functionName":"<main>","argumentNames":[]}
76
+ _main___P98987.continuations = [ ]
77
77
 
78
- function _main___P98912_mk(s) {
78
+ function _main___P98987_mk(s) {
79
79
  checkStack(s.depth);
80
80
  return {
81
- parent: s, fn: _main___P98912, depth: s.depth + 1,
81
+ parent: s, fn: _main___P98987, 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___P98912_mk(s) {
88
88
 
89
89
  const breakpoints = setupDebugger(1, [])
90
90
 
91
- return _main___P98912
91
+ return _main___P98987
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___P60162(s) {
59
+ function _main___P60191(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___60405 = (undefined);
70
- globals._pollEventQueue___60418 = (undefined);
69
+ globals._intervals___60434 = (undefined);
70
+ globals._pollEventQueue___60447 = (undefined);
71
71
  r0 = undefined;
72
72
  return leave(s, r0)
73
73
  default: oops()
74
74
  } } }
75
- _main___P60162.info = {"start":0,"length":0,"line":0,"column":0,"endLine":0,"endColumn":0,"fileName":"lora.ts","functionName":"<main>","argumentNames":[]}
76
- _main___P60162.continuations = [ ]
75
+ _main___P60191.info = {"start":0,"length":0,"line":0,"column":0,"endLine":0,"endColumn":0,"fileName":"lora.ts","functionName":"<main>","argumentNames":[]}
76
+ _main___P60191.continuations = [ ]
77
77
 
78
- function _main___P60162_mk(s) {
78
+ function _main___P60191_mk(s) {
79
79
  checkStack(s.depth);
80
80
  return {
81
- parent: s, fn: _main___P60162, depth: s.depth + 1,
81
+ parent: s, fn: _main___P60191, 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___P60162_mk(s) {
88
88
 
89
89
  const breakpoints = setupDebugger(1, [])
90
90
 
91
- return _main___P60162
91
+ return _main___P60191
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___P192540(s) {
59
+ function _main___P192707(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___192783 = (undefined);
70
- globals._pollEventQueue___192796 = (undefined);
69
+ globals._intervals___192950 = (undefined);
70
+ globals._pollEventQueue___192963 = (undefined);
71
71
  r0 = undefined;
72
72
  return leave(s, r0)
73
73
  default: oops()
74
74
  } } }
75
- _main___P192540.info = {"start":0,"length":0,"line":0,"column":0,"endLine":0,"endColumn":0,"fileName":"keypad.ts","functionName":"<main>","argumentNames":[]}
76
- _main___P192540.continuations = [ ]
75
+ _main___P192707.info = {"start":0,"length":0,"line":0,"column":0,"endLine":0,"endColumn":0,"fileName":"keypad.ts","functionName":"<main>","argumentNames":[]}
76
+ _main___P192707.continuations = [ ]
77
77
 
78
- function _main___P192540_mk(s) {
78
+ function _main___P192707_mk(s) {
79
79
  checkStack(s.depth);
80
80
  return {
81
- parent: s, fn: _main___P192540, depth: s.depth + 1,
81
+ parent: s, fn: _main___P192707, 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___P192540_mk(s) {
88
88
 
89
89
  const breakpoints = setupDebugger(1, [])
90
90
 
91
- return _main___P192540
91
+ return _main___P192707
92
92
  })
@@ -0,0 +1,38 @@
1
+ # create Song
2
+
3
+ Create a song from the notes of one or more musical instruments.
4
+
5
+ ```sig
6
+ music.createSong(hex`00780004080200`)
7
+ ```
8
+
9
+ A song is composed of notes from different instruments in the Song Editor. The [Song Editor](/reference/music/song-editor) is displayed by clicking on the music staff window in the ``||music:song||`` block.
10
+
11
+ ```block
12
+ music.createSong(hex`0078000408020200001c00010a006400f40164000004000000000000000000000000000500000430000400080001220c001000012514001800011e1c00200001222400280001252c003000012934003800012c3c004000011e03001c0001dc00690000045e010004000000000000000000000564000104000330000400080001290c001000011e1400180001251c002000012924002800011b2c003000012234003800011e3c0040000129`)
13
+ ```
14
+
15
+ The Song Editor contains a `Treble` and `Bass` clef for you to compose your music with the notes from your selected instruments. You can set `tempo` an add measures to the staff shown in the editor window. When you're done, the song is set as general data into the **buffer** parameter.
16
+
17
+ ## Parameters
18
+
19
+ * **buffer**: the data containing the notes played by each instrument in the song.
20
+
21
+ ## Returns
22
+
23
+ * a [playable](/types/playable) object for the notes contained in **buffer**.
24
+
25
+ ## Example #example
26
+
27
+ Play a song composed in the Song Editor.
28
+
29
+ ```blocks
30
+ music.play(music.createSong(hex`0078000408020200001c00010a006400f40164000004000000000000000000000000000500000430000400080001220c001000012514001800011e1c00200001222400280001252c003000012934003800012c3c004000011e03001c0001dc00690000045e010004000000000000000000000564000104000330000400080001290c001000011e1400180001251c002000012924002800011b2c003000012234003800011e3c0040000129`), music.PlaybackMode.UntilDone)
31
+ ```
32
+
33
+ ## See also #seealso
34
+
35
+ [tone playable](/reference/music/tone-playable),
36
+ [string playable](/reference/music/string-playable),
37
+ [melody playable](/reference/music/melody-playable),
38
+ [song editor](/reference/music/song-editor)
@@ -0,0 +1,30 @@
1
+ # melody Playable
2
+
3
+ Create a playable melody from a built-in melody.
4
+
5
+ ```sig
6
+ music.melodyPlayable(music.baDing)
7
+ ```
8
+
9
+ Melodies are a sequence of notes that played one after the other. There are several built-in melodies you can play in your games. An easy way to add music to your game is to choose one of the built-in melodies.
10
+
11
+ ## Parameters
12
+
13
+ * **melody**: a built-in melody to create a playable object for, such as `ba ding`, `magic wand`, or `siren`.
14
+
15
+ ## Returns
16
+
17
+ * a [playable](/types/playable) object that contains the built-in **melody**.
18
+
19
+ ## Example #example
20
+
21
+ Play the `magic wand` melody until it is done.
22
+
23
+ ```blocks
24
+ music.play(music.melodyPlayable(music.magicWand), music.PlaybackMode.UntilDone)
25
+ ```
26
+
27
+ ## See also #seealso
28
+
29
+ [tone playable](/reference/music/tone-playable),
30
+ [string playable](/reference/music/string-playable)