pxt-common-packages 10.1.7 → 10.1.10
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.
- package/built/common-sim.js +3 -3
- package/libs/azureiot/built/debug/binary.js +461 -461
- package/libs/color/built/debug/binary.js +8 -8
- package/libs/color-sensor/built/debug/binary.js +8 -8
- package/libs/controller/built/debug/binary.js +8032 -7916
- package/libs/controller---none/built/debug/binary.js +8011 -7895
- package/libs/datalogger/built/debug/binary.js +63 -63
- package/libs/edge-connector/built/debug/binary.js +8 -8
- package/libs/esp32/built/debug/binary.js +462 -462
- package/libs/game/built/debug/binary.js +7924 -7808
- package/libs/game/camera.ts +3 -4
- package/libs/game/physics.ts +30 -0
- package/libs/game/sprite.ts +0 -22
- package/libs/game---light/compat.ts +10 -0
- package/libs/game---light/pxt.json +1 -3
- package/libs/lcd/built/debug/binary.js +8 -8
- package/libs/light-spectrum-sensor/built/debug/binary.js +8 -8
- package/libs/lora/built/debug/binary.js +8 -8
- package/libs/matrix-keypad/built/debug/binary.js +8 -8
- package/libs/mixer/melody.ts +2 -2
- package/libs/mixer/pxt.json +1 -0
- package/libs/mixer/sim/music.ts +1 -1
- package/libs/mixer/soundEffect.ts +380 -0
- package/libs/mqtt/built/debug/binary.js +176 -176
- package/libs/net/built/debug/binary.js +176 -176
- package/libs/net-game/built/debug/binary.js +9712 -9596
- package/libs/palette/built/debug/binary.js +7923 -7807
- package/libs/pixel/built/debug/binary.js +8 -8
- package/libs/power/built/debug/binary.js +8 -8
- package/libs/proximity/built/debug/binary.js +8 -8
- package/libs/radio/built/debug/binary.js +8 -8
- package/libs/radio-broadcast/built/debug/binary.js +8 -8
- package/libs/rotary-encoder/built/debug/binary.js +8 -8
- package/libs/screen/built/debug/binary.js +50 -50
- package/libs/screen/sim/image.ts +2 -2
- package/libs/screen---st7735/screen.cpp +7 -0
- package/libs/servo/built/debug/binary.js +8 -8
- package/libs/sprite-scaling/built/debug/binary.js +7923 -7807
- package/libs/storyboard/built/debug/binary.js +7923 -7807
- package/package.json +2 -2
package/libs/game/camera.ts
CHANGED
|
@@ -67,7 +67,7 @@ namespace scene {
|
|
|
67
67
|
if (amplitude <= 0 || duration <= 0) {
|
|
68
68
|
this.shakeStartTime = undefined;
|
|
69
69
|
} else {
|
|
70
|
-
// this overrides any existing shake operation
|
|
70
|
+
// this overrides any existing shake operation
|
|
71
71
|
this.shakeStartTime = control.millis();
|
|
72
72
|
this.shakeAmplitude = amplitude;
|
|
73
73
|
this.shakeDuration = duration;
|
|
@@ -82,9 +82,8 @@ namespace scene {
|
|
|
82
82
|
this.offsetY = this.sprite.y - (screen.height >> 1);
|
|
83
83
|
}
|
|
84
84
|
|
|
85
|
-
|
|
86
|
-
this.
|
|
87
|
-
this.offsetY |= 0;
|
|
85
|
+
this.offsetX = Math.floor(this.offsetX);
|
|
86
|
+
this.offsetY = Math.floor(this.offsetY);
|
|
88
87
|
|
|
89
88
|
this.drawOffsetX = this.offsetX;
|
|
90
89
|
this.drawOffsetY = this.offsetY;
|
package/libs/game/physics.ts
CHANGED
|
@@ -195,6 +195,13 @@ class ArcadePhysicsEngine extends PhysicsEngine {
|
|
|
195
195
|
if (tileMap && tileMap.enabled) {
|
|
196
196
|
this.tilemapCollisions(ms, tileMap);
|
|
197
197
|
}
|
|
198
|
+
|
|
199
|
+
// check for screen edge collisions
|
|
200
|
+
const bounce = s.flags & sprites.Flag.BounceOnWall;
|
|
201
|
+
if (s.flags & sprites.Flag.StayInScreen || (bounce && !tileMap)) {
|
|
202
|
+
this.screenEdgeCollisions(ms, bounce, scene.camera);
|
|
203
|
+
}
|
|
204
|
+
|
|
198
205
|
// if sprite still needs to move, add it to the next step of movements
|
|
199
206
|
if (Fx.abs(ms.dx) > MIN_MOVE_GAP || Fx.abs(ms.dy) > MIN_MOVE_GAP) {
|
|
200
207
|
remainingMovers.push(ms);
|
|
@@ -346,6 +353,29 @@ class ArcadePhysicsEngine extends PhysicsEngine {
|
|
|
346
353
|
}
|
|
347
354
|
}
|
|
348
355
|
|
|
356
|
+
protected screenEdgeCollisions(movingSprite: MovingSprite, bounce: number, camera: scene.Camera) {
|
|
357
|
+
let s = movingSprite.sprite;
|
|
358
|
+
if (!s.isStatic()) s.setHitbox();
|
|
359
|
+
|
|
360
|
+
let offset = Fx.toFloat(s._hitbox.left) - camera.offsetX;
|
|
361
|
+
if (offset < 0) {
|
|
362
|
+
s.left -= offset;
|
|
363
|
+
if (bounce) s.vx = -s.vx;
|
|
364
|
+
}
|
|
365
|
+
else if ((offset = Fx.toFloat(s._hitbox.right) - camera.offsetX - screen.width) > 0) {
|
|
366
|
+
s.right -= offset;
|
|
367
|
+
if (bounce) s.vx = -s.vx;
|
|
368
|
+
}
|
|
369
|
+
if ((offset = Fx.toFloat(s._hitbox.top) - camera.offsetY) < 0) {
|
|
370
|
+
s.top -= offset;
|
|
371
|
+
if (bounce) s.vy = -s.vy;
|
|
372
|
+
}
|
|
373
|
+
else if ((offset = Fx.toFloat(s._hitbox.bottom) - camera.offsetY - screen.height) > 0) {
|
|
374
|
+
s.bottom -= offset;
|
|
375
|
+
if (bounce) s.vy = -s.vy;
|
|
376
|
+
}
|
|
377
|
+
}
|
|
378
|
+
|
|
349
379
|
protected tilemapCollisions(movingSprite: MovingSprite, tm: tiles.TileMap) {
|
|
350
380
|
const s = movingSprite.sprite;
|
|
351
381
|
// if the sprite is already clipping into a wall,
|
package/libs/game/sprite.ts
CHANGED
|
@@ -639,28 +639,6 @@ class Sprite extends sprites.BaseSprite {
|
|
|
639
639
|
this.destroy()
|
|
640
640
|
}
|
|
641
641
|
|
|
642
|
-
const bounce = this.flags & sprites.Flag.BounceOnWall;
|
|
643
|
-
const tm = game.currentScene().tileMap;
|
|
644
|
-
if (this.flags & sprites.Flag.StayInScreen || (bounce && !tm)) {
|
|
645
|
-
if (this.left < camera.offsetX) {
|
|
646
|
-
this.left = camera.offsetX;
|
|
647
|
-
if (bounce) this.vx = -this.vx;
|
|
648
|
-
}
|
|
649
|
-
else if (this.right > camera.offsetX + screen.width) {
|
|
650
|
-
this.right = camera.offsetX + screen.width;
|
|
651
|
-
if (bounce) this.vx = -this.vx;
|
|
652
|
-
}
|
|
653
|
-
|
|
654
|
-
if (this.top < camera.offsetY) {
|
|
655
|
-
this.top = camera.offsetY;
|
|
656
|
-
if (bounce) this.vy = -this.vy;
|
|
657
|
-
}
|
|
658
|
-
else if (this.bottom > camera.offsetY + screen.height) {
|
|
659
|
-
this.bottom = camera.offsetY + screen.height;
|
|
660
|
-
if (bounce) this.vy = -this.vy;
|
|
661
|
-
}
|
|
662
|
-
}
|
|
663
|
-
|
|
664
642
|
if (this.sayRenderer) this.sayRenderer.update(dt, camera, this);
|
|
665
643
|
}
|
|
666
644
|
|
|
@@ -4,6 +4,10 @@ namespace scene.systemMenu {
|
|
|
4
4
|
}
|
|
5
5
|
}
|
|
6
6
|
|
|
7
|
+
namespace power {
|
|
8
|
+
export function poke() {}
|
|
9
|
+
}
|
|
10
|
+
|
|
7
11
|
namespace scene {
|
|
8
12
|
export const SCREEN_CLEAR_PRIORITY = 1;
|
|
9
13
|
export const UPDATE_INTERVAL_PRIORITY = 19;
|
|
@@ -20,6 +24,12 @@ class Scene {
|
|
|
20
24
|
millis() {
|
|
21
25
|
return control.millis()
|
|
22
26
|
}
|
|
27
|
+
|
|
28
|
+
constructor() {
|
|
29
|
+
this.buttonEventHandlers = []
|
|
30
|
+
}
|
|
31
|
+
|
|
32
|
+
buttonEventHandlers: controller.ButtonEventHandlerState[];
|
|
23
33
|
}
|
|
24
34
|
|
|
25
35
|
namespace game {
|
|
@@ -56,7 +56,7 @@ const pxsim_pxtrt = pxsim.pxtrt;
|
|
|
56
56
|
const pxsim_numops = pxsim.numops;
|
|
57
57
|
|
|
58
58
|
|
|
59
|
-
function
|
|
59
|
+
function _main___P48318(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.
|
|
70
|
-
globals.
|
|
69
|
+
globals._intervals___48561 = (undefined);
|
|
70
|
+
globals._pollEventQueue___48574 = (undefined);
|
|
71
71
|
r0 = undefined;
|
|
72
72
|
return leave(s, r0)
|
|
73
73
|
default: oops()
|
|
74
74
|
} } }
|
|
75
|
-
|
|
76
|
-
|
|
75
|
+
_main___P48318.info = {"start":0,"length":0,"line":0,"column":0,"endLine":0,"endColumn":0,"fileName":"characterlcd.ts","functionName":"<main>","argumentNames":[]}
|
|
76
|
+
_main___P48318.continuations = [ ]
|
|
77
77
|
|
|
78
|
-
function
|
|
78
|
+
function _main___P48318_mk(s) {
|
|
79
79
|
checkStack(s.depth);
|
|
80
80
|
return {
|
|
81
|
-
parent: s, fn:
|
|
81
|
+
parent: s, fn: _main___P48318, 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___P48221_mk(s) {
|
|
|
88
88
|
|
|
89
89
|
const breakpoints = setupDebugger(1, [])
|
|
90
90
|
|
|
91
|
-
return
|
|
91
|
+
return _main___P48318
|
|
92
92
|
})
|
|
@@ -56,7 +56,7 @@ const pxsim_pxtrt = pxsim.pxtrt;
|
|
|
56
56
|
const pxsim_numops = pxsim.numops;
|
|
57
57
|
|
|
58
58
|
|
|
59
|
-
function
|
|
59
|
+
function _main___P97286(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.
|
|
70
|
-
globals.
|
|
69
|
+
globals._intervals___97529 = (undefined);
|
|
70
|
+
globals._pollEventQueue___97542 = (undefined);
|
|
71
71
|
r0 = undefined;
|
|
72
72
|
return leave(s, r0)
|
|
73
73
|
default: oops()
|
|
74
74
|
} } }
|
|
75
|
-
|
|
76
|
-
|
|
75
|
+
_main___P97286.info = {"start":0,"length":0,"line":0,"column":0,"endLine":0,"endColumn":0,"fileName":"tsl2591.ts","functionName":"<main>","argumentNames":[]}
|
|
76
|
+
_main___P97286.continuations = [ ]
|
|
77
77
|
|
|
78
|
-
function
|
|
78
|
+
function _main___P97286_mk(s) {
|
|
79
79
|
checkStack(s.depth);
|
|
80
80
|
return {
|
|
81
|
-
parent: s, fn:
|
|
81
|
+
parent: s, fn: _main___P97286, 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___P96995_mk(s) {
|
|
|
88
88
|
|
|
89
89
|
const breakpoints = setupDebugger(1, [])
|
|
90
90
|
|
|
91
|
-
return
|
|
91
|
+
return _main___P97286
|
|
92
92
|
})
|
|
@@ -56,7 +56,7 @@ const pxsim_pxtrt = pxsim.pxtrt;
|
|
|
56
56
|
const pxsim_numops = pxsim.numops;
|
|
57
57
|
|
|
58
58
|
|
|
59
|
-
function
|
|
59
|
+
function _main___P59620(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.
|
|
70
|
-
globals.
|
|
69
|
+
globals._intervals___59863 = (undefined);
|
|
70
|
+
globals._pollEventQueue___59876 = (undefined);
|
|
71
71
|
r0 = undefined;
|
|
72
72
|
return leave(s, r0)
|
|
73
73
|
default: oops()
|
|
74
74
|
} } }
|
|
75
|
-
|
|
76
|
-
|
|
75
|
+
_main___P59620.info = {"start":0,"length":0,"line":0,"column":0,"endLine":0,"endColumn":0,"fileName":"lora.ts","functionName":"<main>","argumentNames":[]}
|
|
76
|
+
_main___P59620.continuations = [ ]
|
|
77
77
|
|
|
78
|
-
function
|
|
78
|
+
function _main___P59620_mk(s) {
|
|
79
79
|
checkStack(s.depth);
|
|
80
80
|
return {
|
|
81
|
-
parent: s, fn:
|
|
81
|
+
parent: s, fn: _main___P59620, 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___P59523_mk(s) {
|
|
|
88
88
|
|
|
89
89
|
const breakpoints = setupDebugger(1, [])
|
|
90
90
|
|
|
91
|
-
return
|
|
91
|
+
return _main___P59620
|
|
92
92
|
})
|
|
@@ -56,7 +56,7 @@ const pxsim_pxtrt = pxsim.pxtrt;
|
|
|
56
56
|
const pxsim_numops = pxsim.numops;
|
|
57
57
|
|
|
58
58
|
|
|
59
|
-
function
|
|
59
|
+
function _main___P188746(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.
|
|
70
|
-
globals.
|
|
69
|
+
globals._intervals___188989 = (undefined);
|
|
70
|
+
globals._pollEventQueue___189002 = (undefined);
|
|
71
71
|
r0 = undefined;
|
|
72
72
|
return leave(s, r0)
|
|
73
73
|
default: oops()
|
|
74
74
|
} } }
|
|
75
|
-
|
|
76
|
-
|
|
75
|
+
_main___P188746.info = {"start":0,"length":0,"line":0,"column":0,"endLine":0,"endColumn":0,"fileName":"keypad.ts","functionName":"<main>","argumentNames":[]}
|
|
76
|
+
_main___P188746.continuations = [ ]
|
|
77
77
|
|
|
78
|
-
function
|
|
78
|
+
function _main___P188746_mk(s) {
|
|
79
79
|
checkStack(s.depth);
|
|
80
80
|
return {
|
|
81
|
-
parent: s, fn:
|
|
81
|
+
parent: s, fn: _main___P188746, 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___P188067_mk(s) {
|
|
|
88
88
|
|
|
89
89
|
const breakpoints = setupDebugger(1, [])
|
|
90
90
|
|
|
91
|
-
return
|
|
91
|
+
return _main___P188746
|
|
92
92
|
})
|
package/libs/mixer/melody.ts
CHANGED
|
@@ -112,7 +112,7 @@ namespace music {
|
|
|
112
112
|
|
|
113
113
|
/**
|
|
114
114
|
* Play a melody from the melody editor.
|
|
115
|
-
* @param melody - string of up to eight notes [C D E F G A B C5] or rests [-] separated by spaces,
|
|
115
|
+
* @param melody - string of up to eight notes [C D E F G A B C5] or rests [-] separated by spaces,
|
|
116
116
|
* which will be played one at a time, ex: "E D G F B A C5 B "
|
|
117
117
|
* @param tempo - number in beats per minute (bpm), dictating how long each note will play for
|
|
118
118
|
*/
|
|
@@ -176,7 +176,7 @@ namespace music {
|
|
|
176
176
|
*/
|
|
177
177
|
//% help=music/stop-all-sounds
|
|
178
178
|
//% blockId=music_stop_all_sounds block="stop all sounds"
|
|
179
|
-
//% weight=
|
|
179
|
+
//% weight=45
|
|
180
180
|
//% group="Sounds"
|
|
181
181
|
export function stopAllSounds() {
|
|
182
182
|
Melody.stopAll();
|
package/libs/mixer/pxt.json
CHANGED
package/libs/mixer/sim/music.ts
CHANGED