pxt-common-packages 9.4.15 → 9.4.16
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/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 +4323 -4278
- package/libs/controller---none/built/debug/binary.js +8093 -8048
- 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 +7323 -7278
- package/libs/game/hitbox.ts +42 -1
- package/libs/game/sprite.ts +5 -38
- 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/mqtt/built/debug/binary.js +176 -176
- package/libs/net/built/debug/binary.js +176 -176
- package/libs/net-game/built/debug/binary.js +9687 -9642
- package/libs/palette/built/debug/binary.js +7885 -7840
- 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/servo/built/debug/binary.js +8 -8
- package/libs/sprite-scaling/built/debug/binary.js +7885 -7840
- package/libs/storyboard/built/debug/binary.js +7885 -7840
- package/package.json +1 -1
package/libs/game/hitbox.ts
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
namespace game {
|
|
2
2
|
export class Hitbox {
|
|
3
|
-
hash:
|
|
3
|
+
hash: number;
|
|
4
4
|
parent: Sprite;
|
|
5
5
|
ox: Fx8;
|
|
6
6
|
oy: Fx8;
|
|
@@ -46,7 +46,48 @@ namespace game {
|
|
|
46
46
|
return (x >= this.left) && (x <= this.right) && (y >= this.top) && (y <= this.bottom);
|
|
47
47
|
}
|
|
48
48
|
|
|
49
|
+
updateIfInvalid() {
|
|
50
|
+
if (this.isValid())
|
|
51
|
+
return;
|
|
52
|
+
|
|
53
|
+
const newHitBox = game.calculateHitBox(this.parent);
|
|
54
|
+
|
|
55
|
+
const oMinX = this.ox;
|
|
56
|
+
const oMinY = this.oy;
|
|
57
|
+
const oMaxX = Fx.add(oMinX, this.width);
|
|
58
|
+
const oMaxY = Fx.add(oMinY, this.height);
|
|
59
|
+
|
|
60
|
+
const nMinX = newHitBox.ox;
|
|
61
|
+
const nMinY = newHitBox.oy;
|
|
62
|
+
const nMaxX = Fx.add(nMinX, newHitBox.width);
|
|
63
|
+
const nMaxY = Fx.add(nMinY, newHitBox.height);
|
|
64
|
+
|
|
65
|
+
// total diff in x / y corners between the two hitboxes
|
|
66
|
+
const xDiff = Fx.add(
|
|
67
|
+
Fx.abs(Fx.sub(oMinX, nMinX)),
|
|
68
|
+
Fx.abs(Fx.sub(oMaxX, nMaxX))
|
|
69
|
+
);
|
|
70
|
+
const yDiff = Fx.add(
|
|
71
|
+
Fx.abs(Fx.sub(oMinY, nMinY)),
|
|
72
|
+
Fx.abs(Fx.sub(oMaxY, nMaxY))
|
|
73
|
+
);
|
|
74
|
+
|
|
75
|
+
// If it's just a small change to the hitbox on one axis,
|
|
76
|
+
// don't change the dimensions to avoid random clipping
|
|
77
|
+
if (xDiff > Fx.twoFx8) {
|
|
78
|
+
this.ox = nMinX;
|
|
79
|
+
this.width = newHitBox.width;
|
|
80
|
+
}
|
|
81
|
+
if (yDiff > Fx.twoFx8) {
|
|
82
|
+
this.oy = nMinY;
|
|
83
|
+
this.height = newHitBox.height;
|
|
84
|
+
}
|
|
85
|
+
this.hash = newHitBox.hash;
|
|
86
|
+
}
|
|
87
|
+
|
|
49
88
|
overlapsWith(other: Hitbox): boolean {
|
|
89
|
+
this.updateIfInvalid();
|
|
90
|
+
other.updateIfInvalid();
|
|
50
91
|
if (this.contains(other.left, other.top)) return true;
|
|
51
92
|
if (this.contains(other.left, other.bottom)) return true;
|
|
52
93
|
if (this.contains(other.right, other.top)) return true;
|
package/libs/game/sprite.ts
CHANGED
|
@@ -337,7 +337,7 @@ class Sprite extends sprites.BaseSprite {
|
|
|
337
337
|
}
|
|
338
338
|
|
|
339
339
|
calcDimensionalHash() {
|
|
340
|
-
return
|
|
340
|
+
return this._image.revision() + Fx.toIntShifted(this._width, 8) + Fx.toIntShifted(this._height, 16);
|
|
341
341
|
}
|
|
342
342
|
|
|
343
343
|
resetHitbox() {
|
|
@@ -346,43 +346,10 @@ class Sprite extends sprites.BaseSprite {
|
|
|
346
346
|
}
|
|
347
347
|
|
|
348
348
|
setHitbox() {
|
|
349
|
-
|
|
350
|
-
|
|
351
|
-
|
|
352
|
-
this._hitbox =
|
|
353
|
-
return;
|
|
354
|
-
}
|
|
355
|
-
|
|
356
|
-
const oMinX = this._hitbox.ox;
|
|
357
|
-
const oMinY = this._hitbox.oy;
|
|
358
|
-
const oMaxX = Fx.add(oMinX, this._hitbox.width);
|
|
359
|
-
const oMaxY = Fx.add(oMinY, this._hitbox.height);
|
|
360
|
-
|
|
361
|
-
const nMinX = newHitBox.ox;
|
|
362
|
-
const nMinY = newHitBox.oy;
|
|
363
|
-
const nMaxX = Fx.add(nMinX, newHitBox.width);
|
|
364
|
-
const nMaxY = Fx.add(nMinY, newHitBox.height);
|
|
365
|
-
|
|
366
|
-
// total diff in x / y corners between the two hitboxes
|
|
367
|
-
const xDiff = Fx.add(
|
|
368
|
-
Fx.abs(Fx.sub(oMinX, nMinX)),
|
|
369
|
-
Fx.abs(Fx.sub(oMaxX, nMaxX))
|
|
370
|
-
);
|
|
371
|
-
const yDiff = Fx.add(
|
|
372
|
-
Fx.abs(Fx.sub(oMinY, nMinY)),
|
|
373
|
-
Fx.abs(Fx.sub(oMaxY, nMaxY))
|
|
374
|
-
);
|
|
375
|
-
|
|
376
|
-
// If it's just a small change to the hitbox on one axis,
|
|
377
|
-
// don't change the dimensions to avoid random clipping
|
|
378
|
-
this._hitbox = newHitBox;
|
|
379
|
-
if (xDiff <= Fx.twoFx8) {
|
|
380
|
-
this._hitbox.ox = oMinX;
|
|
381
|
-
this._hitbox.width = Fx.sub(oMaxX, oMinX);
|
|
382
|
-
}
|
|
383
|
-
if (yDiff <= Fx.twoFx8) {
|
|
384
|
-
this._hitbox.oy = oMinY;
|
|
385
|
-
this._hitbox.height = Fx.sub(oMaxY, oMinY);
|
|
349
|
+
if (this._hitbox) {
|
|
350
|
+
this._hitbox.updateIfInvalid();
|
|
351
|
+
} else {
|
|
352
|
+
this._hitbox = game.calculateHitBox(this);
|
|
386
353
|
}
|
|
387
354
|
}
|
|
388
355
|
|
|
@@ -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___P48208(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___48451 = (undefined);
|
|
70
|
+
globals._pollEventQueue___48464 = (undefined);
|
|
71
71
|
r0 = undefined;
|
|
72
72
|
return leave(s, r0)
|
|
73
73
|
default: oops()
|
|
74
74
|
} } }
|
|
75
|
-
|
|
76
|
-
|
|
75
|
+
_main___P48208.info = {"start":0,"length":0,"line":0,"column":0,"endLine":0,"endColumn":0,"fileName":"characterlcd.ts","functionName":"<main>","argumentNames":[]}
|
|
76
|
+
_main___P48208.continuations = [ ]
|
|
77
77
|
|
|
78
|
-
function
|
|
78
|
+
function _main___P48208_mk(s) {
|
|
79
79
|
checkStack(s.depth);
|
|
80
80
|
return {
|
|
81
|
-
parent: s, fn:
|
|
81
|
+
parent: s, fn: _main___P48208, 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___P48209_mk(s) {
|
|
|
88
88
|
|
|
89
89
|
const breakpoints = setupDebugger(1, [])
|
|
90
90
|
|
|
91
|
-
return
|
|
91
|
+
return _main___P48208
|
|
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___P96956(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___97199 = (undefined);
|
|
70
|
+
globals._pollEventQueue___97212 = (undefined);
|
|
71
71
|
r0 = undefined;
|
|
72
72
|
return leave(s, r0)
|
|
73
73
|
default: oops()
|
|
74
74
|
} } }
|
|
75
|
-
|
|
76
|
-
|
|
75
|
+
_main___P96956.info = {"start":0,"length":0,"line":0,"column":0,"endLine":0,"endColumn":0,"fileName":"tsl2591.ts","functionName":"<main>","argumentNames":[]}
|
|
76
|
+
_main___P96956.continuations = [ ]
|
|
77
77
|
|
|
78
|
-
function
|
|
78
|
+
function _main___P96956_mk(s) {
|
|
79
79
|
checkStack(s.depth);
|
|
80
80
|
return {
|
|
81
|
-
parent: s, fn:
|
|
81
|
+
parent: s, fn: _main___P96956, 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___P96959_mk(s) {
|
|
|
88
88
|
|
|
89
89
|
const breakpoints = setupDebugger(1, [])
|
|
90
90
|
|
|
91
|
-
return
|
|
91
|
+
return _main___P96956
|
|
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___P59510(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___59753 = (undefined);
|
|
70
|
+
globals._pollEventQueue___59766 = (undefined);
|
|
71
71
|
r0 = undefined;
|
|
72
72
|
return leave(s, r0)
|
|
73
73
|
default: oops()
|
|
74
74
|
} } }
|
|
75
|
-
|
|
76
|
-
|
|
75
|
+
_main___P59510.info = {"start":0,"length":0,"line":0,"column":0,"endLine":0,"endColumn":0,"fileName":"lora.ts","functionName":"<main>","argumentNames":[]}
|
|
76
|
+
_main___P59510.continuations = [ ]
|
|
77
77
|
|
|
78
|
-
function
|
|
78
|
+
function _main___P59510_mk(s) {
|
|
79
79
|
checkStack(s.depth);
|
|
80
80
|
return {
|
|
81
|
-
parent: s, fn:
|
|
81
|
+
parent: s, fn: _main___P59510, 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___P59511_mk(s) {
|
|
|
88
88
|
|
|
89
89
|
const breakpoints = setupDebugger(1, [])
|
|
90
90
|
|
|
91
|
-
return
|
|
91
|
+
return _main___P59510
|
|
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___P187972(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___188215 = (undefined);
|
|
70
|
+
globals._pollEventQueue___188228 = (undefined);
|
|
71
71
|
r0 = undefined;
|
|
72
72
|
return leave(s, r0)
|
|
73
73
|
default: oops()
|
|
74
74
|
} } }
|
|
75
|
-
|
|
76
|
-
|
|
75
|
+
_main___P187972.info = {"start":0,"length":0,"line":0,"column":0,"endLine":0,"endColumn":0,"fileName":"keypad.ts","functionName":"<main>","argumentNames":[]}
|
|
76
|
+
_main___P187972.continuations = [ ]
|
|
77
77
|
|
|
78
|
-
function
|
|
78
|
+
function _main___P187972_mk(s) {
|
|
79
79
|
checkStack(s.depth);
|
|
80
80
|
return {
|
|
81
|
-
parent: s, fn:
|
|
81
|
+
parent: s, fn: _main___P187972, 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___P187979_mk(s) {
|
|
|
88
88
|
|
|
89
89
|
const breakpoints = setupDebugger(1, [])
|
|
90
90
|
|
|
91
|
-
return
|
|
91
|
+
return _main___P187972
|
|
92
92
|
})
|