pxt-common-packages 13.1.6 → 13.1.8

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 (42) hide show
  1. package/libs/animation/legacy.ts +2 -0
  2. package/libs/azureiot/built/debug/binary.js +461 -461
  3. package/libs/color/built/debug/binary.js +8 -8
  4. package/libs/color-sensor/built/debug/binary.js +8 -8
  5. package/libs/controller/built/debug/binary.js +7348 -7348
  6. package/libs/controller---none/built/debug/binary.js +7328 -7328
  7. package/libs/datalogger/built/debug/binary.js +63 -63
  8. package/libs/edge-connector/built/debug/binary.js +8 -8
  9. package/libs/esp32/built/debug/binary.js +462 -462
  10. package/libs/game/_locales/game-jsdoc-strings.json +1 -0
  11. package/libs/game/_locales/game-strings.json +1 -0
  12. package/libs/game/animation.ts +3 -0
  13. package/libs/game/built/debug/binary.js +7267 -7267
  14. package/libs/game/controller.ts +2 -0
  15. package/libs/game/docs/reference/sprites/sprite/follow.md +1 -0
  16. package/libs/game/docs/reference/sprites/sprite/set-kind.md +1 -1
  17. package/libs/game/docs/reference/sprites/sprite/unfollow.md +62 -0
  18. package/libs/game/particleeffects.ts +1 -0
  19. package/libs/game/scenes.ts +1 -0
  20. package/libs/game/sprite.ts +15 -0
  21. package/libs/game/sprites.ts +1 -0
  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/mqtt/built/debug/binary.js +176 -176
  28. package/libs/net/built/debug/binary.js +176 -176
  29. package/libs/net-game/built/debug/binary.js +8984 -8984
  30. package/libs/palette/built/debug/binary.js +7266 -7266
  31. package/libs/pixel/built/debug/binary.js +8 -8
  32. package/libs/power/built/debug/binary.js +8 -8
  33. package/libs/proximity/built/debug/binary.js +8 -8
  34. package/libs/radio/built/debug/binary.js +8 -8
  35. package/libs/radio-broadcast/built/debug/binary.js +8 -8
  36. package/libs/rotary-encoder/built/debug/binary.js +8 -8
  37. package/libs/screen/built/debug/binary.js +50 -50
  38. package/libs/servo/built/debug/binary.js +8 -8
  39. package/libs/sprite-scaling/built/debug/binary.js +7266 -7266
  40. package/libs/sprite-scaling/scaling.ts +4 -0
  41. package/libs/storyboard/built/debug/binary.js +7266 -7266
  42. package/package.json +1 -1
@@ -183,6 +183,7 @@ namespace controller {
183
183
  //% blockId="ctrlgame_control_sprite" block="%controller move $sprite=variables_get(mySprite) with buttons||vx $vx vy $vy"
184
184
  //% weight=100
185
185
  //% expandableArgumentMode="toggle"
186
+ //% sprite.defl=mySprite
186
187
  //% vx.defl=100 vy.defl=100
187
188
  //% help=controller/move-sprite
188
189
  //% group="Multiplayer"
@@ -433,6 +434,7 @@ namespace controller {
433
434
  //% blockId="game_control_sprite" block="move $sprite=variables_get(mySprite) with buttons||vx $vx vy $vy"
434
435
  //% weight=100
435
436
  //% expandableArgumentMode="toggle"
437
+ //% sprite.defl=mySprite
436
438
  //% vx.defl=100 vy.defl=100
437
439
  //% help=controller/move-sprite
438
440
  //% group="Single Player"
@@ -63,4 +63,5 @@ game.onUpdateInterval(1000, function () {
63
63
 
64
64
  ## See also
65
65
 
66
+ [unfollow](/reference/sprites/sprite/unfollow),
66
67
  [overlaps with](/reference/sprites/sprite/overlaps-with)
@@ -55,7 +55,7 @@ namespace SpriteKind {
55
55
  }
56
56
  ```
57
57
 
58
- During the game, if you need a sprite to change to a different kind, say a ``Planet`` becomes an ``Asteriod``, you just set the new kind with **setKind**.
58
+ During the game, if you need a sprite to change to a different kind, say a ``Planet`` becomes an ``Asteroid``, you just set the new kind with **setKind**.
59
59
 
60
60
  ## Example #example
61
61
 
@@ -0,0 +1,62 @@
1
+ # unfollow
2
+
3
+ Stop a sprite from following any target sprite.
4
+
5
+ ```sig
6
+ sprites.create(null).unfollow()
7
+ ```
8
+
9
+ When you set a sprite to unfollow, it will stop moving toward any previously set target sprite. The sprite's velocity will be set to zero, and it will remain at its current position until you move it again using other methods.
10
+
11
+ ## Example
12
+
13
+ Create 2 sprites. Set the second sprite to follow the first one. After 3 seconds, make the second sprite stop following.
14
+
15
+ ```blocks
16
+ let mySprite = sprites.create(img`
17
+ . . . . . . . . . . . . . . . .
18
+ . . . . . . . . . . . . . . . .
19
+ . . . . . 7 7 7 7 7 7 . . . . .
20
+ . . . 7 7 7 7 7 7 7 7 7 7 . . .
21
+ . . . 7 7 7 7 7 7 7 7 7 7 . . .
22
+ . . 7 7 7 7 7 7 7 7 7 7 7 7 . .
23
+ . . 7 7 7 7 7 7 7 7 7 7 7 7 . .
24
+ . . 7 7 7 7 7 7 7 7 7 7 7 7 . .
25
+ . . 7 7 7 7 7 7 7 7 7 7 7 7 . .
26
+ . . 7 7 7 7 7 7 7 7 7 7 7 7 . .
27
+ . . 7 7 7 7 7 7 7 7 7 7 7 7 . .
28
+ . . . 7 7 7 7 7 7 7 7 7 7 . . .
29
+ . . . 7 7 7 7 7 7 7 7 7 7 . . .
30
+ . . . . . 7 7 7 7 7 7 . . . . .
31
+ . . . . . . . . . . . . . . . .
32
+ . . . . . . . . . . . . . . . .
33
+ `, SpriteKind.Player)
34
+ let mySprite2 = sprites.create(img`
35
+ . . . . . . . . . . . . . . . .
36
+ . . . . . . . . . . . . . . . .
37
+ . . . . . 5 5 5 5 5 5 . . . . .
38
+ . . . 5 5 5 5 5 5 5 5 5 5 . . .
39
+ . . . 5 5 5 5 5 5 5 5 5 5 . . .
40
+ . . 5 5 5 5 5 5 5 5 5 5 5 5 . .
41
+ . . 5 5 5 5 5 5 5 5 5 5 5 5 . .
42
+ . . 5 5 5 5 5 5 5 5 5 5 5 5 . .
43
+ . . 5 5 5 5 5 5 5 5 5 5 5 5 . .
44
+ . . 5 5 5 5 5 5 5 5 5 5 5 5 . .
45
+ . . 5 5 5 5 5 5 5 5 5 5 5 5 . .
46
+ . . . 5 5 5 5 5 5 5 5 5 5 . . .
47
+ . . . 5 5 5 5 5 5 5 5 5 5 . . .
48
+ . . . . . 5 5 5 5 5 5 . . . . .
49
+ . . . . . . . . . . . . . . . .
50
+ . . . . . . . . . . . . . . . .
51
+ `, SpriteKind.Player)
52
+ mySprite2.follow(mySprite, 50)
53
+ game.onUpdateInterval(1000, function () {
54
+ mySprite.setPosition(randint(0, scene.screenWidth()), randint(0, scene.screenHeight()))
55
+ })
56
+ pause(3000)
57
+ mySprite2.unfollow()
58
+ ```
59
+
60
+ ## See also
61
+
62
+ [follow](/reference/sprites/sprite/follow)
@@ -134,6 +134,7 @@ namespace effects {
134
134
  */
135
135
  //% blockId=particlesclearparticles block="clear effects on %anchor=variables_get(mySprite)"
136
136
  //% blockNamespace=sprites
137
+ //% anchor.defl=mySprite
137
138
  //% group="Effects" weight=89
138
139
  //% help=effects/clear-particles
139
140
  export function clearParticles(anchor: Sprite | particles.ParticleAnchor) {
@@ -139,6 +139,7 @@ namespace scene {
139
139
  */
140
140
  //% blockId=camerafollow block="camera follow sprite %sprite=variables_get(mySprite)"
141
141
  //% group="Camera"
142
+ //% sprite.defl=mySprite
142
143
  //% help=scene/camera-follow-sprite
143
144
  //% weight=100
144
145
  export function cameraFollowSprite(sprite: Sprite) {
@@ -767,6 +767,7 @@ class Sprite extends sprites.BaseSprite {
767
767
  */
768
768
  //% group="Overlaps"
769
769
  //% blockId=spriteoverlapswith block="%sprite(mySprite) overlaps with %other=variables_get(otherSprite)"
770
+ //% other.defl=otherSprite
770
771
  //% help=sprites/sprite/overlaps-with
771
772
  //% weight=90
772
773
  overlapsWith(other: Sprite): boolean {
@@ -1015,6 +1016,7 @@ class Sprite extends sprites.BaseSprite {
1015
1016
  //% group="Physics" weight=10
1016
1017
  //% blockId=spriteFollowOtherSprite
1017
1018
  //% block="set %sprite(myEnemy) follow %target=variables_get(mySprite) || with speed %speed"
1019
+ //% target.defl=mySprite
1018
1020
  //% help=sprites/sprite/follow
1019
1021
  follow(target: Sprite, speed = 100, turnRate = 400) {
1020
1022
  if (target === this) return;
@@ -1101,6 +1103,19 @@ class Sprite extends sprites.BaseSprite {
1101
1103
  }
1102
1104
  }
1103
1105
 
1106
+ /**
1107
+ * Stop this sprite from following any target sprite.
1108
+ */
1109
+ //% group="Physics" weight=9
1110
+ //% blockId=spriteUnfollow
1111
+ //% block="set $sprite(myEnemy) unfollow"
1112
+ //% sprite.shadow=variables_get
1113
+ //% sprite.defl=myEnemy
1114
+ //% help=sprites/sprite/unfollow
1115
+ unfollow() {
1116
+ this.follow(null, 0);
1117
+ }
1118
+
1104
1119
  setScaleCore(sx?: number, sy?: number, anchor?: ScaleAnchor, proportional?: boolean): void {
1105
1120
  anchor = anchor || ScaleAnchor.Middle;
1106
1121
 
@@ -125,6 +125,7 @@ namespace sprites {
125
125
  //% blockId=spritescreateprojectilefromsprite block="projectile %img=screen_image_picker from %sprite=variables_get(mySprite) with vx %vx vy %vy"
126
126
  //% vx.shadow=spriteSpeedPicker
127
127
  //% vy.shadow=spriteSpeedPicker
128
+ //% sprite.defl=mySprite
128
129
  //% weight=99 help=sprites/create-projectile-from-sprite
129
130
  //% blockSetVariable=projectile
130
131
  //% inlineInputMode=inline
@@ -744,6 +744,7 @@ namespace tiles {
744
744
  * @param loc
745
745
  */
746
746
  //% blockId=mapplaceontile block="place $sprite=variables_get(mySprite) on top of $loc"
747
+ //% sprite.defl=mySprite
747
748
  //% loc.shadow=mapgettile
748
749
  //% blockNamespace="scene" group="Tilemap Operations" blockGap=8
749
750
  //% help=tiles/place-on-tile
@@ -759,6 +760,7 @@ namespace tiles {
759
760
  * @param tile
760
761
  */
761
762
  //% blockId=mapplaceonrandomtile block="place $sprite=variables_get(mySprite) on top of random $tile"
763
+ //% sprite.defl=mySprite
762
764
  //% tile.shadow=tileset_tile_picker
763
765
  //% tile.decompileIndirectFixedInstances=true
764
766
  //% blockNamespace="scene" group="Tilemap Operations"
@@ -56,7 +56,7 @@ const pxsim_pxtrt = pxsim.pxtrt;
56
56
  const pxsim_numops = pxsim.numops;
57
57
 
58
58
 
59
- function _main___P49368(s) {
59
+ function _main___P49369(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___49612 = (undefined);
70
- globals._pollEventQueue___49625 = (undefined);
69
+ globals._intervals___49613 = (undefined);
70
+ globals._pollEventQueue___49626 = (undefined);
71
71
  r0 = undefined;
72
72
  return leave(s, r0)
73
73
  default: oops()
74
74
  } } }
75
- _main___P49368.info = {"start":0,"length":0,"line":0,"column":0,"endLine":0,"endColumn":0,"fileName":"characterlcd.ts","functionName":"<main>","argumentNames":[]}
76
- _main___P49368.continuations = [ ]
75
+ _main___P49369.info = {"start":0,"length":0,"line":0,"column":0,"endLine":0,"endColumn":0,"fileName":"characterlcd.ts","functionName":"<main>","argumentNames":[]}
76
+ _main___P49369.continuations = [ ]
77
77
 
78
- function _main___P49368_mk(s) {
78
+ function _main___P49369_mk(s) {
79
79
  checkStack(s.depth);
80
80
  return {
81
- parent: s, fn: _main___P49368, depth: s.depth + 1,
81
+ parent: s, fn: _main___P49369, depth: s.depth + 1,
82
82
  pc: 0, retval: undefined, r0: undefined, overwrittenPC: false, lambdaArgs: null,
83
83
  } }
84
84
 
@@ -87,5 +87,5 @@ function _main___P49368_mk(s) {
87
87
 
88
88
  const breakpoints = setupDebugger(1, [])
89
89
 
90
- return _main___P49368
90
+ return _main___P49369
91
91
  })
@@ -56,7 +56,7 @@ const pxsim_pxtrt = pxsim.pxtrt;
56
56
  const pxsim_numops = pxsim.numops;
57
57
 
58
58
 
59
- function _main___P100627(s) {
59
+ function _main___P100630(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___100871 = (undefined);
70
- globals._pollEventQueue___100884 = (undefined);
69
+ globals._intervals___100874 = (undefined);
70
+ globals._pollEventQueue___100887 = (undefined);
71
71
  r0 = undefined;
72
72
  return leave(s, r0)
73
73
  default: oops()
74
74
  } } }
75
- _main___P100627.info = {"start":0,"length":0,"line":0,"column":0,"endLine":0,"endColumn":0,"fileName":"tsl2591.ts","functionName":"<main>","argumentNames":[]}
76
- _main___P100627.continuations = [ ]
75
+ _main___P100630.info = {"start":0,"length":0,"line":0,"column":0,"endLine":0,"endColumn":0,"fileName":"tsl2591.ts","functionName":"<main>","argumentNames":[]}
76
+ _main___P100630.continuations = [ ]
77
77
 
78
- function _main___P100627_mk(s) {
78
+ function _main___P100630_mk(s) {
79
79
  checkStack(s.depth);
80
80
  return {
81
- parent: s, fn: _main___P100627, depth: s.depth + 1,
81
+ parent: s, fn: _main___P100630, depth: s.depth + 1,
82
82
  pc: 0, retval: undefined, r0: undefined, overwrittenPC: false, lambdaArgs: null,
83
83
  } }
84
84
 
@@ -87,5 +87,5 @@ function _main___P100627_mk(s) {
87
87
 
88
88
  const breakpoints = setupDebugger(1, [])
89
89
 
90
- return _main___P100627
90
+ return _main___P100630
91
91
  })
@@ -56,7 +56,7 @@ const pxsim_pxtrt = pxsim.pxtrt;
56
56
  const pxsim_numops = pxsim.numops;
57
57
 
58
58
 
59
- function _main___P60651(s) {
59
+ function _main___P60652(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___60895 = (undefined);
70
- globals._pollEventQueue___60908 = (undefined);
69
+ globals._intervals___60896 = (undefined);
70
+ globals._pollEventQueue___60909 = (undefined);
71
71
  r0 = undefined;
72
72
  return leave(s, r0)
73
73
  default: oops()
74
74
  } } }
75
- _main___P60651.info = {"start":0,"length":0,"line":0,"column":0,"endLine":0,"endColumn":0,"fileName":"lora.ts","functionName":"<main>","argumentNames":[]}
76
- _main___P60651.continuations = [ ]
75
+ _main___P60652.info = {"start":0,"length":0,"line":0,"column":0,"endLine":0,"endColumn":0,"fileName":"lora.ts","functionName":"<main>","argumentNames":[]}
76
+ _main___P60652.continuations = [ ]
77
77
 
78
- function _main___P60651_mk(s) {
78
+ function _main___P60652_mk(s) {
79
79
  checkStack(s.depth);
80
80
  return {
81
- parent: s, fn: _main___P60651, depth: s.depth + 1,
81
+ parent: s, fn: _main___P60652, depth: s.depth + 1,
82
82
  pc: 0, retval: undefined, r0: undefined, overwrittenPC: false, lambdaArgs: null,
83
83
  } }
84
84
 
@@ -87,5 +87,5 @@ function _main___P60651_mk(s) {
87
87
 
88
88
  const breakpoints = setupDebugger(1, [])
89
89
 
90
- return _main___P60651
90
+ return _main___P60652
91
91
  })
@@ -56,7 +56,7 @@ const pxsim_pxtrt = pxsim.pxtrt;
56
56
  const pxsim_numops = pxsim.numops;
57
57
 
58
58
 
59
- function _main___P196981(s) {
59
+ function _main___P196988(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___197225 = (undefined);
70
- globals._pollEventQueue___197238 = (undefined);
69
+ globals._intervals___197232 = (undefined);
70
+ globals._pollEventQueue___197245 = (undefined);
71
71
  r0 = undefined;
72
72
  return leave(s, r0)
73
73
  default: oops()
74
74
  } } }
75
- _main___P196981.info = {"start":0,"length":0,"line":0,"column":0,"endLine":0,"endColumn":0,"fileName":"keypad.ts","functionName":"<main>","argumentNames":[]}
76
- _main___P196981.continuations = [ ]
75
+ _main___P196988.info = {"start":0,"length":0,"line":0,"column":0,"endLine":0,"endColumn":0,"fileName":"keypad.ts","functionName":"<main>","argumentNames":[]}
76
+ _main___P196988.continuations = [ ]
77
77
 
78
- function _main___P196981_mk(s) {
78
+ function _main___P196988_mk(s) {
79
79
  checkStack(s.depth);
80
80
  return {
81
- parent: s, fn: _main___P196981, depth: s.depth + 1,
81
+ parent: s, fn: _main___P196988, depth: s.depth + 1,
82
82
  pc: 0, retval: undefined, r0: undefined, overwrittenPC: false, lambdaArgs: null,
83
83
  } }
84
84
 
@@ -87,5 +87,5 @@ function _main___P196981_mk(s) {
87
87
 
88
88
  const breakpoints = setupDebugger(1, [])
89
89
 
90
- return _main___P196981
90
+ return _main___P196988
91
91
  })