pxt-common-packages 9.5.10 → 10.0.1
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 +66 -66
- 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 +6897 -6897
- package/libs/controller---none/built/debug/binary.js +6877 -6877
- 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 +6816 -6816
- package/libs/game/docs/reference/tiles/tile-image-at-location.md +65 -0
- package/libs/game/game.ts +3 -0
- package/libs/game/info.ts +13 -0
- package/libs/game/sim/keymap.ts +3 -3
- package/libs/game/sprite.ts +1 -0
- package/libs/game/tilemap.ts +1 -1
- 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 +8405 -8405
- package/libs/palette/built/debug/binary.js +6815 -6815
- 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/settings---files/settings.cpp +2 -1
- package/libs/sprite-scaling/built/debug/binary.js +6815 -6815
- package/libs/storyboard/built/debug/binary.js +6815 -6815
- package/package.json +1 -1
|
@@ -0,0 +1,65 @@
|
|
|
1
|
+
# tile Image At Location
|
|
2
|
+
|
|
3
|
+
Get the image of the tile at a location in the tilemap.
|
|
4
|
+
|
|
5
|
+
```sig
|
|
6
|
+
tiles.tileImageAtLocation(tiles.getTileAtLocation(0, 0))
|
|
7
|
+
```
|
|
8
|
+
|
|
9
|
+
## Parameters
|
|
10
|
+
|
|
11
|
+
* **location**: the [location](/reference/tiles/location) object for the tile to return it's image.
|
|
12
|
+
|
|
13
|
+
## Returns
|
|
14
|
+
|
|
15
|
+
* the [image](/types/image) of the tile at the **location** in the tilemap.
|
|
16
|
+
|
|
17
|
+
## Example #example
|
|
18
|
+
|
|
19
|
+
Make a tilemap with some smiley face tiles. Create a new sprite using the image from one of the smiley face tiles. Have the new sprite move across the screen and back.
|
|
20
|
+
|
|
21
|
+
```blocks
|
|
22
|
+
scene.onHitWall(SpriteKind.Player, function (sprite, location) {
|
|
23
|
+
sprite.startEffect(effects.bubbles, 500)
|
|
24
|
+
})
|
|
25
|
+
tiles.setCurrentTilemap(tilemap`level1`)
|
|
26
|
+
let tileImage = tiles.tileImageAtLocation(tiles.getTileLocation(0, 0))
|
|
27
|
+
let mySprite = sprites.create(tileImage, SpriteKind.Player)
|
|
28
|
+
mySprite.setBounceOnWall(true)
|
|
29
|
+
mySprite.vx = 50
|
|
30
|
+
```
|
|
31
|
+
|
|
32
|
+
## See also #seealso
|
|
33
|
+
|
|
34
|
+
[location](/reference/tiles/location)
|
|
35
|
+
|
|
36
|
+
```jres
|
|
37
|
+
{
|
|
38
|
+
"transparency16": {
|
|
39
|
+
"data": "hwQQABAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA==",
|
|
40
|
+
"mimeType": "image/x-mkcd-f4",
|
|
41
|
+
"tilemapTile": true
|
|
42
|
+
},
|
|
43
|
+
"tile1": {
|
|
44
|
+
"data": "hwQQABAAAABERERERERERERERERERERERPT/RET/RERE9PRERERPRET0/0RERPRERERERERE9ERERERERET0RERERPRPRPRERERE9E9E9ERERERERET0RERERERERPRERPT/RERE9ERE9PRERERPRET0/0RE/0RERERERERERERERERERERERA==",
|
|
45
|
+
"mimeType": "image/x-mkcd-f4",
|
|
46
|
+
"tilemapTile": true,
|
|
47
|
+
"displayName": "myTile"
|
|
48
|
+
},
|
|
49
|
+
"level1": {
|
|
50
|
+
"id": "level1",
|
|
51
|
+
"mimeType": "application/mkcd-tilemap",
|
|
52
|
+
"data": "MTAwYTAwMDgwMDAxMDAwMTAwMDEwMDAxMDAwMTAwMDAwMDAwMDAwMDAwMDAwMDAwMDAwMDAwMDAwMDAwMDAwMDAwMDAwMDAwMDAwMDAwMDAwMDAwMDAwMDAwMDAwMDAwMDAwMDAwMDAwMDAwMDAwMDAwMDAwMDAwMDAwMDAwMDAwMDAxMDAwMTAwMDEwMDAxMDAwMTAwMDAwMDAwMDAwMDAwMDAwMDAwMDAwMDAwMDAwMDAwMDAwMDAwMDAwMDAwMDAwMDAwMDAwMDAwMDAwMDAwMDAwMDAwMDAwMDAwMDAwMDAwMDAwMDAwMDAwMDAwMDAwMDAwMDAwMA==",
|
|
53
|
+
"tileset": [
|
|
54
|
+
"myTiles.transparency16",
|
|
55
|
+
"myTiles.tile1"
|
|
56
|
+
],
|
|
57
|
+
"displayName": "level1"
|
|
58
|
+
},
|
|
59
|
+
"*": {
|
|
60
|
+
"mimeType": "image/x-mkcd-f4",
|
|
61
|
+
"dataEncoding": "base64",
|
|
62
|
+
"namespace": "myTiles"
|
|
63
|
+
}
|
|
64
|
+
}
|
|
65
|
+
```
|
package/libs/game/game.ts
CHANGED
|
@@ -191,6 +191,9 @@ namespace game {
|
|
|
191
191
|
effect = win ? winEffect : loseEffect;
|
|
192
192
|
}
|
|
193
193
|
|
|
194
|
+
// Save all scores as relevant to the game.
|
|
195
|
+
info.saveAllScores();
|
|
196
|
+
|
|
194
197
|
// collect the scores before poping the scenes
|
|
195
198
|
const scoreInfo = info.player1.getState();
|
|
196
199
|
const highScore = info.highScore();
|
package/libs/game/info.ts
CHANGED
|
@@ -204,6 +204,19 @@ namespace info {
|
|
|
204
204
|
`;
|
|
205
205
|
}
|
|
206
206
|
|
|
207
|
+
export function saveAllScores() {
|
|
208
|
+
const allScoresKey = "all-scores";
|
|
209
|
+
let allScores: number[];
|
|
210
|
+
if (players) {
|
|
211
|
+
allScores = players.filter(item => item.hasScore()).map(item => item.score());
|
|
212
|
+
}
|
|
213
|
+
else {
|
|
214
|
+
allScores = [];
|
|
215
|
+
}
|
|
216
|
+
|
|
217
|
+
settings.writeJSON(allScoresKey, allScores);
|
|
218
|
+
}
|
|
219
|
+
|
|
207
220
|
export function saveHighScore() {
|
|
208
221
|
if (players) {
|
|
209
222
|
let hs = 0;
|
package/libs/game/sim/keymap.ts
CHANGED
|
@@ -67,9 +67,9 @@ namespace pxsim {
|
|
|
67
67
|
this.setPlayerKeys(
|
|
68
68
|
1, // Player 1
|
|
69
69
|
87, // W - Up
|
|
70
|
-
83, //
|
|
70
|
+
83, // S - Down
|
|
71
71
|
65, // A - Left
|
|
72
|
-
|
|
72
|
+
68, // D - Right
|
|
73
73
|
32, // Space - A
|
|
74
74
|
13 // Enter - B
|
|
75
75
|
);
|
|
@@ -79,7 +79,7 @@ namespace pxsim {
|
|
|
79
79
|
73, // I - Up
|
|
80
80
|
75, // K - Down
|
|
81
81
|
74, // J - Left
|
|
82
|
-
|
|
82
|
+
76, // L - Right
|
|
83
83
|
85, // U - A
|
|
84
84
|
79 // O - B
|
|
85
85
|
);
|
package/libs/game/sprite.ts
CHANGED
|
@@ -857,6 +857,7 @@ class Sprite extends sprites.BaseSprite {
|
|
|
857
857
|
//% this.shadow=variables_get
|
|
858
858
|
//% this.defl=mySprite
|
|
859
859
|
//% blockNamespace="scene" group="Locations" weight=90
|
|
860
|
+
//% help=scene/tilemap-location
|
|
860
861
|
tilemapLocation(): tiles.Location {
|
|
861
862
|
const scene = game.currentScene();
|
|
862
863
|
if (!scene.tileMap) return undefined;
|
package/libs/game/tilemap.ts
CHANGED
|
@@ -110,7 +110,7 @@ namespace tiles {
|
|
|
110
110
|
//% this.defl=location
|
|
111
111
|
//% this.shadow=variables_get
|
|
112
112
|
//% group="Locations" blockGap=8
|
|
113
|
-
//% weight=10
|
|
113
|
+
//% weight=10 help=tiles/get-neighboring-location
|
|
114
114
|
public getNeighboringLocation(direction: CollisionDirection): Location {
|
|
115
115
|
switch (direction) {
|
|
116
116
|
case CollisionDirection.Top:
|
|
@@ -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___P48217(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___48460 = (undefined);
|
|
70
|
+
globals._pollEventQueue___48473 = (undefined);
|
|
71
71
|
r0 = undefined;
|
|
72
72
|
return leave(s, r0)
|
|
73
73
|
default: oops()
|
|
74
74
|
} } }
|
|
75
|
-
|
|
76
|
-
|
|
75
|
+
_main___P48217.info = {"start":0,"length":0,"line":0,"column":0,"endLine":0,"endColumn":0,"fileName":"characterlcd.ts","functionName":"<main>","argumentNames":[]}
|
|
76
|
+
_main___P48217.continuations = [ ]
|
|
77
77
|
|
|
78
|
-
function
|
|
78
|
+
function _main___P48217_mk(s) {
|
|
79
79
|
checkStack(s.depth);
|
|
80
80
|
return {
|
|
81
|
-
parent: s, fn:
|
|
81
|
+
parent: s, fn: _main___P48217, 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___P48216_mk(s) {
|
|
|
88
88
|
|
|
89
89
|
const breakpoints = setupDebugger(1, [])
|
|
90
90
|
|
|
91
|
-
return
|
|
91
|
+
return _main___P48217
|
|
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___P96983(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___97226 = (undefined);
|
|
70
|
+
globals._pollEventQueue___97239 = (undefined);
|
|
71
71
|
r0 = undefined;
|
|
72
72
|
return leave(s, r0)
|
|
73
73
|
default: oops()
|
|
74
74
|
} } }
|
|
75
|
-
|
|
76
|
-
|
|
75
|
+
_main___P96983.info = {"start":0,"length":0,"line":0,"column":0,"endLine":0,"endColumn":0,"fileName":"tsl2591.ts","functionName":"<main>","argumentNames":[]}
|
|
76
|
+
_main___P96983.continuations = [ ]
|
|
77
77
|
|
|
78
|
-
function
|
|
78
|
+
function _main___P96983_mk(s) {
|
|
79
79
|
checkStack(s.depth);
|
|
80
80
|
return {
|
|
81
|
-
parent: s, fn:
|
|
81
|
+
parent: s, fn: _main___P96983, 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___P96980_mk(s) {
|
|
|
88
88
|
|
|
89
89
|
const breakpoints = setupDebugger(1, [])
|
|
90
90
|
|
|
91
|
-
return
|
|
91
|
+
return _main___P96983
|
|
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___P59519(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___59762 = (undefined);
|
|
70
|
+
globals._pollEventQueue___59775 = (undefined);
|
|
71
71
|
r0 = undefined;
|
|
72
72
|
return leave(s, r0)
|
|
73
73
|
default: oops()
|
|
74
74
|
} } }
|
|
75
|
-
|
|
76
|
-
|
|
75
|
+
_main___P59519.info = {"start":0,"length":0,"line":0,"column":0,"endLine":0,"endColumn":0,"fileName":"lora.ts","functionName":"<main>","argumentNames":[]}
|
|
76
|
+
_main___P59519.continuations = [ ]
|
|
77
77
|
|
|
78
|
-
function
|
|
78
|
+
function _main___P59519_mk(s) {
|
|
79
79
|
checkStack(s.depth);
|
|
80
80
|
return {
|
|
81
|
-
parent: s, fn:
|
|
81
|
+
parent: s, fn: _main___P59519, 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___P59518_mk(s) {
|
|
|
88
88
|
|
|
89
89
|
const breakpoints = setupDebugger(1, [])
|
|
90
90
|
|
|
91
|
-
return
|
|
91
|
+
return _main___P59519
|
|
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___P188039(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___188282 = (undefined);
|
|
70
|
+
globals._pollEventQueue___188295 = (undefined);
|
|
71
71
|
r0 = undefined;
|
|
72
72
|
return leave(s, r0)
|
|
73
73
|
default: oops()
|
|
74
74
|
} } }
|
|
75
|
-
|
|
76
|
-
|
|
75
|
+
_main___P188039.info = {"start":0,"length":0,"line":0,"column":0,"endLine":0,"endColumn":0,"fileName":"keypad.ts","functionName":"<main>","argumentNames":[]}
|
|
76
|
+
_main___P188039.continuations = [ ]
|
|
77
77
|
|
|
78
|
-
function
|
|
78
|
+
function _main___P188039_mk(s) {
|
|
79
79
|
checkStack(s.depth);
|
|
80
80
|
return {
|
|
81
|
-
parent: s, fn:
|
|
81
|
+
parent: s, fn: _main___P188039, 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___P188032_mk(s) {
|
|
|
88
88
|
|
|
89
89
|
const breakpoints = setupDebugger(1, [])
|
|
90
90
|
|
|
91
|
-
return
|
|
91
|
+
return _main___P188039
|
|
92
92
|
})
|