pxt-common-packages 10.3.2 → 10.3.4

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 (41) hide show
  1. package/built/common-sim.d.ts +2 -2
  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 +7736 -7608
  6. package/libs/controller---none/built/debug/binary.js +7715 -7587
  7. package/libs/datalogger/built/debug/binary.js +63 -63
  8. package/libs/edge-connector/built/debug/binary.js +9 -9
  9. package/libs/esp32/built/debug/binary.js +462 -462
  10. package/libs/game/built/debug/binary.js +7628 -7500
  11. package/libs/game/camera.ts +18 -13
  12. package/libs/game/physics.ts +2 -1
  13. package/libs/game/scenes.ts +3 -0
  14. package/libs/lcd/built/debug/binary.js +8 -8
  15. package/libs/light-spectrum-sensor/built/debug/binary.js +8 -8
  16. package/libs/lora/built/debug/binary.js +8 -8
  17. package/libs/matrix-keypad/built/debug/binary.js +8 -8
  18. package/libs/mqtt/built/debug/binary.js +176 -176
  19. package/libs/multiplayer/README.md +4 -0
  20. package/libs/multiplayer/docs/.gitkeep +0 -0
  21. package/libs/multiplayer/fieldEditors.ts +23 -0
  22. package/libs/multiplayer/images.ts +303 -0
  23. package/libs/multiplayer/mp.ts +625 -0
  24. package/libs/multiplayer/pxt.json +19 -0
  25. package/libs/multiplayer/stateKind.ts +14 -0
  26. package/libs/multiplayer/targetoverrides.ts +1 -0
  27. package/libs/multiplayer/test.ts +0 -0
  28. package/libs/net/built/debug/binary.js +176 -176
  29. package/libs/net-game/built/debug/binary.js +9540 -9412
  30. package/libs/palette/built/debug/binary.js +7627 -7499
  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 +7627 -7499
  40. package/libs/storyboard/built/debug/binary.js +7627 -7499
  41. package/package.json +1 -1
@@ -8,6 +8,8 @@ namespace scene {
8
8
  drawOffsetX: number;
9
9
  drawOffsetY: number;
10
10
  sprite: Sprite;
11
+ protected _lastUpdatedSpriteX: number;
12
+ protected _lastUpdatedSpriteY: number;
11
13
 
12
14
  protected shakeStartTime: number;
13
15
  protected shakeDuration: number;
@@ -27,9 +29,9 @@ namespace scene {
27
29
  set offsetX(v: number) {
28
30
  const scene = game.currentScene();
29
31
  if (scene.tileMap && scene.tileMap.enabled) {
30
- this._offsetX = scene.tileMap.offsetX(v);
32
+ this._offsetX = Math.floor(scene.tileMap.offsetX(v));
31
33
  } else {
32
- this._offsetX = v;
34
+ this._offsetX = Math.floor(v);
33
35
  }
34
36
  }
35
37
  get offsetY() {
@@ -38,29 +40,29 @@ namespace scene {
38
40
  set offsetY(v: number) {
39
41
  const scene = game.currentScene();
40
42
  if (scene.tileMap && scene.tileMap.enabled) {
41
- this._offsetY = scene.tileMap.offsetY(v);
43
+ this._offsetY = Math.floor(scene.tileMap.offsetY(v));
42
44
  } else {
43
- this._offsetY = v;
45
+ this._offsetY = Math.floor(v);
44
46
  }
45
47
  }
46
48
 
47
49
  get x() {
48
- return this.drawOffsetX + (screen.width >> 1);
50
+ return this.offsetX + (screen.width >> 1);
49
51
  }
50
52
  get y() {
51
- return this.drawOffsetY + (screen.height >> 1);
53
+ return this.offsetY + (screen.height >> 1);
52
54
  }
53
55
  get left() {
54
- return this.drawOffsetX;
56
+ return this.offsetX;
55
57
  }
56
58
  get right() {
57
- return this.drawOffsetX + screen.width;
59
+ return this.offsetX + screen.width;
58
60
  }
59
61
  get top() {
60
- return this.drawOffsetY;
62
+ return this.offsetY;
61
63
  }
62
64
  get bottom() {
63
- return this.drawOffsetY + screen.height;
65
+ return this.offsetY + screen.height;
64
66
  }
65
67
 
66
68
  shake(amplitude: number = 4, duration: number = 1000) {
@@ -75,16 +77,19 @@ namespace scene {
75
77
  }
76
78
  }
77
79
 
80
+ isUpdated() {
81
+ return !this.sprite || (this.sprite.x === this._lastUpdatedSpriteX && this.sprite.y === this._lastUpdatedSpriteY);
82
+ }
83
+
78
84
  update() {
79
85
  // if sprite, follow sprite
80
86
  if (this.sprite) {
87
+ this._lastUpdatedSpriteX = this.sprite.x;
88
+ this._lastUpdatedSpriteY = this.sprite.y;
81
89
  this.offsetX = this.sprite.x - (screen.width >> 1);
82
90
  this.offsetY = this.sprite.y - (screen.height >> 1);
83
91
  }
84
92
 
85
- this.offsetX = Math.floor(this.offsetX);
86
- this.offsetY = Math.floor(this.offsetY);
87
-
88
93
  this.drawOffsetX = this.offsetX;
89
94
  this.drawOffsetY = this.offsetY;
90
95
 
@@ -195,7 +195,7 @@ class ArcadePhysicsEngine extends PhysicsEngine {
195
195
  if (tileMap && tileMap.enabled) {
196
196
  this.tilemapCollisions(ms, tileMap);
197
197
  }
198
-
198
+
199
199
  // check for screen edge collisions
200
200
  const bounce = s.flags & sprites.Flag.BounceOnWall;
201
201
  if (s.flags & sprites.Flag.StayInScreen || (bounce && !tileMap)) {
@@ -356,6 +356,7 @@ class ArcadePhysicsEngine extends PhysicsEngine {
356
356
  protected screenEdgeCollisions(movingSprite: MovingSprite, bounce: number, camera: scene.Camera) {
357
357
  let s = movingSprite.sprite;
358
358
  if (!s.isStatic()) s.setHitbox();
359
+ if (!camera.isUpdated()) camera.update();
359
360
 
360
361
  let offset = Fx.toFloat(s._hitbox.left) - camera.offsetX;
361
362
  if (offset < 0) {
@@ -144,6 +144,7 @@ namespace scene {
144
144
  export function cameraFollowSprite(sprite: Sprite) {
145
145
  const scene = game.currentScene();
146
146
  scene.camera.sprite = sprite;
147
+ scene.camera.update();
147
148
  }
148
149
 
149
150
  /**
@@ -195,6 +196,8 @@ namespace scene {
195
196
  //% weight=70
196
197
  export function cameraProperty(property: CameraProperty): number {
197
198
  const scene = game.currentScene();
199
+ if (!scene.camera.isUpdated())
200
+ scene.camera.update();
198
201
  switch (property) {
199
202
  case CameraProperty.X: return scene.camera.x;
200
203
  case CameraProperty.Y: return scene.camera.y;
@@ -56,7 +56,7 @@ const pxsim_pxtrt = pxsim.pxtrt;
56
56
  const pxsim_numops = pxsim.numops;
57
57
 
58
58
 
59
- function _main___P48539(s) {
59
+ function _main___P48572(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___48782 = (undefined);
70
- globals._pollEventQueue___48795 = (undefined);
69
+ globals._intervals___48815 = (undefined);
70
+ globals._pollEventQueue___48828 = (undefined);
71
71
  r0 = undefined;
72
72
  return leave(s, r0)
73
73
  default: oops()
74
74
  } } }
75
- _main___P48539.info = {"start":0,"length":0,"line":0,"column":0,"endLine":0,"endColumn":0,"fileName":"characterlcd.ts","functionName":"<main>","argumentNames":[]}
76
- _main___P48539.continuations = [ ]
75
+ _main___P48572.info = {"start":0,"length":0,"line":0,"column":0,"endLine":0,"endColumn":0,"fileName":"characterlcd.ts","functionName":"<main>","argumentNames":[]}
76
+ _main___P48572.continuations = [ ]
77
77
 
78
- function _main___P48539_mk(s) {
78
+ function _main___P48572_mk(s) {
79
79
  checkStack(s.depth);
80
80
  return {
81
- parent: s, fn: _main___P48539, depth: s.depth + 1,
81
+ parent: s, fn: _main___P48572, 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___P48539_mk(s) {
88
88
 
89
89
  const breakpoints = setupDebugger(1, [])
90
90
 
91
- return _main___P48539
91
+ return _main___P48572
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___P97949(s) {
59
+ function _main___P98048(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___98192 = (undefined);
70
- globals._pollEventQueue___98205 = (undefined);
69
+ globals._intervals___98291 = (undefined);
70
+ globals._pollEventQueue___98304 = (undefined);
71
71
  r0 = undefined;
72
72
  return leave(s, r0)
73
73
  default: oops()
74
74
  } } }
75
- _main___P97949.info = {"start":0,"length":0,"line":0,"column":0,"endLine":0,"endColumn":0,"fileName":"tsl2591.ts","functionName":"<main>","argumentNames":[]}
76
- _main___P97949.continuations = [ ]
75
+ _main___P98048.info = {"start":0,"length":0,"line":0,"column":0,"endLine":0,"endColumn":0,"fileName":"tsl2591.ts","functionName":"<main>","argumentNames":[]}
76
+ _main___P98048.continuations = [ ]
77
77
 
78
- function _main___P97949_mk(s) {
78
+ function _main___P98048_mk(s) {
79
79
  checkStack(s.depth);
80
80
  return {
81
- parent: s, fn: _main___P97949, depth: s.depth + 1,
81
+ parent: s, fn: _main___P98048, 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___P97949_mk(s) {
88
88
 
89
89
  const breakpoints = setupDebugger(1, [])
90
90
 
91
- return _main___P97949
91
+ return _main___P98048
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___P59841(s) {
59
+ function _main___P59874(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___60084 = (undefined);
70
- globals._pollEventQueue___60097 = (undefined);
69
+ globals._intervals___60117 = (undefined);
70
+ globals._pollEventQueue___60130 = (undefined);
71
71
  r0 = undefined;
72
72
  return leave(s, r0)
73
73
  default: oops()
74
74
  } } }
75
- _main___P59841.info = {"start":0,"length":0,"line":0,"column":0,"endLine":0,"endColumn":0,"fileName":"lora.ts","functionName":"<main>","argumentNames":[]}
76
- _main___P59841.continuations = [ ]
75
+ _main___P59874.info = {"start":0,"length":0,"line":0,"column":0,"endLine":0,"endColumn":0,"fileName":"lora.ts","functionName":"<main>","argumentNames":[]}
76
+ _main___P59874.continuations = [ ]
77
77
 
78
- function _main___P59841_mk(s) {
78
+ function _main___P59874_mk(s) {
79
79
  checkStack(s.depth);
80
80
  return {
81
- parent: s, fn: _main___P59841, depth: s.depth + 1,
81
+ parent: s, fn: _main___P59874, 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___P59841_mk(s) {
88
88
 
89
89
  const breakpoints = setupDebugger(1, [])
90
90
 
91
- return _main___P59841
91
+ return _main___P59874
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___P190293(s) {
59
+ function _main___P190524(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___190536 = (undefined);
70
- globals._pollEventQueue___190549 = (undefined);
69
+ globals._intervals___190767 = (undefined);
70
+ globals._pollEventQueue___190780 = (undefined);
71
71
  r0 = undefined;
72
72
  return leave(s, r0)
73
73
  default: oops()
74
74
  } } }
75
- _main___P190293.info = {"start":0,"length":0,"line":0,"column":0,"endLine":0,"endColumn":0,"fileName":"keypad.ts","functionName":"<main>","argumentNames":[]}
76
- _main___P190293.continuations = [ ]
75
+ _main___P190524.info = {"start":0,"length":0,"line":0,"column":0,"endLine":0,"endColumn":0,"fileName":"keypad.ts","functionName":"<main>","argumentNames":[]}
76
+ _main___P190524.continuations = [ ]
77
77
 
78
- function _main___P190293_mk(s) {
78
+ function _main___P190524_mk(s) {
79
79
  checkStack(s.depth);
80
80
  return {
81
- parent: s, fn: _main___P190293, depth: s.depth + 1,
81
+ parent: s, fn: _main___P190524, 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___P190293_mk(s) {
88
88
 
89
89
  const breakpoints = setupDebugger(1, [])
90
90
 
91
- return _main___P190293
91
+ return _main___P190524
92
92
  })