pxt-common-packages 10.3.7 → 10.3.9
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 +15483 -15338
- package/libs/controller---none/built/debug/binary.js +15467 -15322
- 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/_locales/game-jsdoc-strings.json +8 -3
- package/libs/game/_locales/game-strings.json +11 -0
- package/libs/game/ask.ts +0 -1
- package/libs/game/built/debug/binary.js +16092 -15947
- package/libs/game/controller.ts +0 -6
- package/libs/game/game.ts +194 -45
- package/libs/game/gameutil.ts +0 -2
- package/libs/game/info.ts +98 -45
- package/libs/game/multiplayer.ts +9 -8
- package/libs/game/ns.ts +5 -0
- package/libs/game/numberprompt.ts +0 -1
- package/libs/game/particleeffects.ts +30 -0
- package/libs/game/prompt.ts +0 -1
- package/libs/game/pxt.json +1 -0
- package/libs/game/textDialogs.ts +275 -40
- 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/instrument.ts +20 -1
- package/libs/mixer/melody.ts +13 -15
- package/libs/mixer/playable.ts +181 -0
- package/libs/mixer/pxt.json +1 -0
- package/libs/mixer/soundEffect.ts +19 -2
- package/libs/mqtt/built/debug/binary.js +176 -176
- package/libs/multiplayer/ns.ts +6 -0
- package/libs/multiplayer/player.ts +24 -6
- package/libs/multiplayer/pxt.json +1 -0
- package/libs/music/ns.ts +1 -1
- package/libs/net/built/debug/binary.js +176 -176
- package/libs/net-game/built/debug/binary.js +20403 -20258
- package/libs/palette/built/debug/binary.js +16083 -15938
- 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 +16091 -15946
- package/libs/storyboard/built/debug/binary.js +16091 -15946
- package/package.json +1 -1
package/libs/game/multiplayer.ts
CHANGED
|
@@ -1,18 +1,10 @@
|
|
|
1
1
|
namespace multiplayer {
|
|
2
|
-
enum IconType {
|
|
3
|
-
Player = 0,
|
|
4
|
-
Reaction = 1,
|
|
5
|
-
}
|
|
6
|
-
|
|
7
2
|
//% shim=multiplayer::getCurrentImage
|
|
8
3
|
declare function getCurrentImage(): Image;
|
|
9
4
|
|
|
10
5
|
//% shim=multiplayer::postImage
|
|
11
6
|
declare function postImage(im: Image): void;
|
|
12
7
|
|
|
13
|
-
//% shim=multiplayer::postIcon
|
|
14
|
-
declare function postIcon(type: IconType, slot: number, im: Image): void;
|
|
15
|
-
|
|
16
8
|
//% shim=multiplayer::setOrigin
|
|
17
9
|
declare function setOrigin(origin: string): void;
|
|
18
10
|
|
|
@@ -42,6 +34,15 @@ namespace multiplayer {
|
|
|
42
34
|
})
|
|
43
35
|
}
|
|
44
36
|
}
|
|
37
|
+
}
|
|
38
|
+
|
|
39
|
+
namespace mp {
|
|
40
|
+
enum IconType {
|
|
41
|
+
Player = 0,
|
|
42
|
+
Reaction = 1,
|
|
43
|
+
}
|
|
44
|
+
//% shim=multiplayer::postIcon
|
|
45
|
+
declare function postIcon(type: IconType, slot: number, im: Image): void;
|
|
45
46
|
|
|
46
47
|
export function postPresenceIcon(slot: number, im: Image, implicit?: boolean) {
|
|
47
48
|
initIconState();
|
package/libs/game/ns.ts
ADDED
|
@@ -5,7 +5,6 @@ namespace game {
|
|
|
5
5
|
* @param message The message to display on the text-entry screen
|
|
6
6
|
* @param answerLength The maximum number of digits the user can enter (1 - 10)
|
|
7
7
|
*/
|
|
8
|
-
//% group="Gameplay"
|
|
9
8
|
//% weight=10 help=game/ask-for-number
|
|
10
9
|
//% blockId=gameaskfornumber block="ask for number %message || and max length %answerLength"
|
|
11
10
|
//% message.shadow=text
|
|
@@ -337,4 +337,34 @@ namespace effects {
|
|
|
337
337
|
source.z = -2;
|
|
338
338
|
return source;
|
|
339
339
|
});
|
|
340
|
+
|
|
341
|
+
//% fixedInstance whenUsed block="none"
|
|
342
|
+
export const none = new ScreenEffect(0, 0, 0, function (anchor: particles.ParticleAnchor, particlesPerSecond: number) {
|
|
343
|
+
class NullParticleSource extends particles.ParticleSource {
|
|
344
|
+
constructor() {
|
|
345
|
+
super(null, 0);
|
|
346
|
+
this._prune();
|
|
347
|
+
}
|
|
348
|
+
|
|
349
|
+
__draw(camera: scene.Camera) {}
|
|
350
|
+
|
|
351
|
+
_update(dt: number) {}
|
|
352
|
+
|
|
353
|
+
// remove self at next opportunity
|
|
354
|
+
_prune() {
|
|
355
|
+
const scene = game.currentScene();
|
|
356
|
+
if (!scene)
|
|
357
|
+
return;
|
|
358
|
+
scene.allSprites.removeElement(this);
|
|
359
|
+
const sources = scene.particleSources;
|
|
360
|
+
if (sources && sources.length)
|
|
361
|
+
sources.removeElement(this);
|
|
362
|
+
}
|
|
363
|
+
destroy() { this._prune(); }
|
|
364
|
+
clear() { this.head = undefined; }
|
|
365
|
+
}
|
|
366
|
+
const source = new NullParticleSource();
|
|
367
|
+
|
|
368
|
+
return source;
|
|
369
|
+
});
|
|
340
370
|
}
|
package/libs/game/prompt.ts
CHANGED
|
@@ -16,7 +16,6 @@ namespace game {
|
|
|
16
16
|
* @param message The message to display on the text-entry screen
|
|
17
17
|
* @param answerLength The maximum number of characters the user can enter (1 - 24)
|
|
18
18
|
*/
|
|
19
|
-
//% group="Gameplay"
|
|
20
19
|
//% weight=10 help=game/ask-for-string
|
|
21
20
|
//% blockId=gameaskforstring block="ask for string %message || and max length %answerLength"
|
|
22
21
|
//% message.shadow=text
|
package/libs/game/pxt.json
CHANGED
package/libs/game/textDialogs.ts
CHANGED
|
@@ -14,6 +14,22 @@ enum DialogLayout {
|
|
|
14
14
|
}
|
|
15
15
|
|
|
16
16
|
namespace game {
|
|
17
|
+
function padStr(len: number): string {
|
|
18
|
+
let str = "";
|
|
19
|
+
for (let i = 0; i < len; ++i) {
|
|
20
|
+
str += " ";
|
|
21
|
+
}
|
|
22
|
+
return str;
|
|
23
|
+
}
|
|
24
|
+
|
|
25
|
+
function replaceRange(dst: string, src: string, start: number, len: number): string {
|
|
26
|
+
return dst.substr(0, start) + src.substr(0, len) + dst.substr(start + len);
|
|
27
|
+
}
|
|
28
|
+
|
|
29
|
+
function screenColor(c: number): number {
|
|
30
|
+
return screen.isMono ? 1 : c;
|
|
31
|
+
}
|
|
32
|
+
|
|
17
33
|
let dialogFrame: Image;
|
|
18
34
|
let dialogCursor: Image;
|
|
19
35
|
let dialogTextColor: number;
|
|
@@ -36,24 +52,21 @@ namespace game {
|
|
|
36
52
|
textColor: number;
|
|
37
53
|
|
|
38
54
|
constructor(width: number, height: number, frame?: Image, font?: image.Font, cursor?: Image) {
|
|
39
|
-
this.
|
|
55
|
+
this.cursorCount = 0;
|
|
56
|
+
this.resize(width, height, frame, font, cursor);
|
|
57
|
+
}
|
|
40
58
|
|
|
59
|
+
resize(width: number, height: number, frame?: Image, font?: image.Font, cursor?: Image) {
|
|
41
60
|
this.frame = frame || dialogFrame || (dialogFrame = defaultFrame());
|
|
42
|
-
|
|
43
|
-
this.font = font || image.font8;
|
|
44
|
-
|
|
45
|
-
this.cursor = cursor || dialogCursor || (dialogCursor = defaultCursorImage());
|
|
46
|
-
|
|
47
|
-
this.textColor = dialogTextColor == undefined ? dialogTextColor = 15 : dialogTextColor;
|
|
48
|
-
|
|
49
61
|
this.unit = Math.floor(this.frame.width / 3);
|
|
50
62
|
this.columns = Math.floor(width / this.unit);
|
|
51
63
|
this.rows = Math.floor(height / this.unit);
|
|
52
|
-
|
|
53
64
|
this.innerLeft = (width - (this.columns * this.unit)) >> 1;
|
|
54
65
|
this.innerTop = (height - (this.rows * this.unit)) >> 1;
|
|
55
|
-
|
|
56
|
-
this.
|
|
66
|
+
this.image = image.create(width, height);
|
|
67
|
+
this.font = font || image.font8;
|
|
68
|
+
this.cursor = cursor || dialogCursor || (dialogCursor = defaultCursorImage());
|
|
69
|
+
this.textColor = dialogTextColor == undefined ? dialogTextColor = 15 : dialogTextColor;
|
|
57
70
|
|
|
58
71
|
this.drawBorder();
|
|
59
72
|
this.clearInterior();
|
|
@@ -332,18 +345,150 @@ namespace game {
|
|
|
332
345
|
}
|
|
333
346
|
}
|
|
334
347
|
|
|
348
|
+
const img_trophy_sm = img`
|
|
349
|
+
. . . . . . .
|
|
350
|
+
. 4 5 5 5 1 .
|
|
351
|
+
. 4 5 5 5 1 .
|
|
352
|
+
. 4 5 5 5 1 .
|
|
353
|
+
. . 4 5 1 . .
|
|
354
|
+
. . . 5 . . .
|
|
355
|
+
. . 4 5 1 . .
|
|
356
|
+
. . . . . . .
|
|
357
|
+
`;
|
|
358
|
+
|
|
359
|
+
const img_trophy_lg = img`
|
|
360
|
+
. . . . . . . . . . . . . . . .
|
|
361
|
+
. . . . . . . . . . . . . . . .
|
|
362
|
+
. . . . . 5 5 5 5 5 5 . . . . .
|
|
363
|
+
. . . . 5 4 4 4 4 4 4 5 . . . .
|
|
364
|
+
. . . . 5 5 5 5 5 5 5 5 . . . .
|
|
365
|
+
. . . . 4 5 5 5 5 5 5 1 . . . .
|
|
366
|
+
. . . 5 4 4 5 5 5 5 1 1 5 . . .
|
|
367
|
+
. . 5 . 4 4 5 5 5 5 1 1 . 5 . .
|
|
368
|
+
. . 5 . 4 4 5 5 5 5 1 1 . 5 . .
|
|
369
|
+
. . . 5 4 4 5 5 5 5 1 1 5 . . .
|
|
370
|
+
. . . . 4 4 5 5 5 5 1 1 . . . .
|
|
371
|
+
. . . . . 4 5 5 5 1 1 . . . . .
|
|
372
|
+
. . . . . . 4 5 1 1 . . . . . .
|
|
373
|
+
. . . . . . . 4 1 . . . . . . .
|
|
374
|
+
. . . . . 4 4 5 5 1 1 . . . . .
|
|
375
|
+
. . . . . . . . . . . . . . . .
|
|
376
|
+
`;
|
|
377
|
+
|
|
378
|
+
const img_sleepy_sim = img`
|
|
379
|
+
. . . . . . . . . . . . . . . .
|
|
380
|
+
. . . 6 6 6 6 6 6 6 6 6 6 . . .
|
|
381
|
+
. . 6 f f f f f f f f f f 6 . .
|
|
382
|
+
. . 6 f f f f f f f f f f 6 . .
|
|
383
|
+
. . 6 f f 1 1 f f 1 1 f f 6 . .
|
|
384
|
+
. . 6 f f f f f f f f f f 6 . .
|
|
385
|
+
. . 6 f f f f 1 1 f f f f 6 . .
|
|
386
|
+
. . 6 f f f f f f f f f f 6 . .
|
|
387
|
+
. . 6 6 6 6 6 6 6 6 6 6 6 6 . .
|
|
388
|
+
. . 6 6 f 6 6 6 6 6 6 6 f 6 . .
|
|
389
|
+
. . 6 f f f 6 6 6 6 6 6 6 6 . .
|
|
390
|
+
. . 6 6 f 6 6 6 6 6 f 6 6 6 . .
|
|
391
|
+
. . 6 6 6 6 6 6 6 6 6 6 6 6 . .
|
|
392
|
+
. . . 6 6 6 6 6 6 6 6 6 6 . . .
|
|
393
|
+
. . . . . . . . . . . . . . . .
|
|
394
|
+
. . . . . . . . . . . . . . . .
|
|
395
|
+
`;
|
|
396
|
+
|
|
397
|
+
export class GameOverPlayerScore {
|
|
398
|
+
public str: string;
|
|
399
|
+
constructor(
|
|
400
|
+
public player: number,
|
|
401
|
+
public value: number,
|
|
402
|
+
public winner: boolean) { }
|
|
403
|
+
}
|
|
404
|
+
|
|
405
|
+
enum GameOverDialogFlags {
|
|
406
|
+
WIN = 1,
|
|
407
|
+
HAS_BEST = 2,
|
|
408
|
+
NEW_BEST = 4,
|
|
409
|
+
MULTIPLAYER = 8,
|
|
410
|
+
HAS_SCORES = 16
|
|
411
|
+
};
|
|
412
|
+
|
|
335
413
|
export class GameOverDialog extends game.BaseDialog {
|
|
336
414
|
protected cursorOn: boolean;
|
|
337
|
-
protected
|
|
415
|
+
protected flags: GameOverDialogFlags;
|
|
416
|
+
protected height: number;
|
|
417
|
+
|
|
418
|
+
get isWinCondition() { return !!(this.flags & GameOverDialogFlags.WIN); }
|
|
419
|
+
get isJudgedGame() { return this.judged; }
|
|
420
|
+
get hasScores() { return !!(this.flags & GameOverDialogFlags.HAS_SCORES); }
|
|
421
|
+
get hasBestScore() { return !!(this.flags & GameOverDialogFlags.HAS_BEST); }
|
|
422
|
+
get isNewBestScore() { return !!(this.flags & GameOverDialogFlags.NEW_BEST); }
|
|
423
|
+
get isMultiplayerGame() { return !!(this.flags & GameOverDialogFlags.MULTIPLAYER); }
|
|
338
424
|
|
|
339
425
|
constructor(
|
|
340
|
-
|
|
341
|
-
protected
|
|
342
|
-
protected
|
|
426
|
+
win: boolean,
|
|
427
|
+
protected message: string,
|
|
428
|
+
protected judged: boolean,
|
|
429
|
+
protected scores: GameOverPlayerScore[],
|
|
430
|
+
protected bestScore?: number,
|
|
431
|
+
protected winnerOverride?: number
|
|
343
432
|
) {
|
|
344
433
|
super(screen.width, 46, defaultSplashFrame());
|
|
345
434
|
this.cursorOn = false;
|
|
346
|
-
this.
|
|
435
|
+
this.flags = 0;
|
|
436
|
+
|
|
437
|
+
if (win) {
|
|
438
|
+
this.flags |= GameOverDialogFlags.WIN;
|
|
439
|
+
}
|
|
440
|
+
|
|
441
|
+
// Fixup states in case of winner override
|
|
442
|
+
if (winnerOverride) {
|
|
443
|
+
win = true;
|
|
444
|
+
this.flags |= GameOverDialogFlags.WIN;
|
|
445
|
+
// For display purposes, treat this as a multiplayer game
|
|
446
|
+
this.flags |= GameOverDialogFlags.MULTIPLAYER;
|
|
447
|
+
const score = scores.find(score => score.player === winnerOverride);
|
|
448
|
+
if (!score) {
|
|
449
|
+
scores.push(new GameOverPlayerScore(winnerOverride, null, true));
|
|
450
|
+
scores.sort((a, b) => a.player - b.player);
|
|
451
|
+
}
|
|
452
|
+
scores.forEach(score => score.winner = score.player === winnerOverride);
|
|
453
|
+
}
|
|
454
|
+
|
|
455
|
+
if (scores.length) {
|
|
456
|
+
// If any score present is other than player 1, this is a multiplayer game
|
|
457
|
+
scores.forEach(score => score.player > 1 && (this.flags |= GameOverDialogFlags.MULTIPLAYER));
|
|
458
|
+
if (win) {
|
|
459
|
+
let winner = scores.find(score => score.winner);
|
|
460
|
+
if (!winner && scores.length === 1) winner = scores[0];
|
|
461
|
+
if (winner) {
|
|
462
|
+
if (winner.value != null) {
|
|
463
|
+
if (bestScore == null) {
|
|
464
|
+
this.bestScore = winner.value;
|
|
465
|
+
this.flags |= GameOverDialogFlags.NEW_BEST;
|
|
466
|
+
} else if (info.isBetterScore(winner.value, bestScore)) {
|
|
467
|
+
this.bestScore = winner.value;
|
|
468
|
+
this.flags |= GameOverDialogFlags.NEW_BEST;
|
|
469
|
+
}
|
|
470
|
+
}
|
|
471
|
+
// Replace string tokens with resolved values
|
|
472
|
+
this.message = this.message
|
|
473
|
+
.replaceAll("${WINNER}", "PLAYER " + winner.player)
|
|
474
|
+
.replaceAll("${Winner}", "Player " + winner.player)
|
|
475
|
+
.replaceAll("${winner}", "player " + winner.player)
|
|
476
|
+
.replaceAll("${winner_short}", "P" + winner.player);
|
|
477
|
+
}
|
|
478
|
+
}
|
|
479
|
+
}
|
|
480
|
+
|
|
481
|
+
const scoresWithValues = scores.filter(score => score.value != null);
|
|
482
|
+
if (scoresWithValues.length) this.flags |= GameOverDialogFlags.HAS_SCORES;
|
|
483
|
+
|
|
484
|
+
if (this.isWinCondition && this.isJudgedGame && this.hasScores && (this.bestScore != null)) {
|
|
485
|
+
this.flags |= GameOverDialogFlags.HAS_BEST;
|
|
486
|
+
}
|
|
487
|
+
|
|
488
|
+
// Two scores per row
|
|
489
|
+
const scoreRows = Math.max(0, scoresWithValues.length - 1) >> 1;
|
|
490
|
+
this.height = 47 + scoreRows * image.font5.charHeight;
|
|
491
|
+
this.resize(screen.width, this.height, defaultSplashFrame());
|
|
347
492
|
}
|
|
348
493
|
|
|
349
494
|
displayCursor() {
|
|
@@ -359,44 +504,134 @@ namespace game {
|
|
|
359
504
|
}
|
|
360
505
|
}
|
|
361
506
|
|
|
362
|
-
|
|
363
|
-
const
|
|
507
|
+
drawMessage() {
|
|
508
|
+
const currY = 5;
|
|
364
509
|
this.image.printCenter(
|
|
365
|
-
this.
|
|
366
|
-
|
|
367
|
-
|
|
510
|
+
this.message,
|
|
511
|
+
currY,
|
|
512
|
+
screenColor(5),
|
|
368
513
|
image.font8
|
|
369
514
|
);
|
|
515
|
+
}
|
|
370
516
|
|
|
371
|
-
|
|
372
|
-
|
|
373
|
-
const
|
|
374
|
-
|
|
375
|
-
|
|
376
|
-
|
|
377
|
-
|
|
378
|
-
|
|
379
|
-
|
|
380
|
-
|
|
381
|
-
|
|
517
|
+
drawScores() {
|
|
518
|
+
if (this.hasScores) {
|
|
519
|
+
const scores = this.scores.filter(score => score.value != null);
|
|
520
|
+
let currY = image.font5.charHeight + 16;
|
|
521
|
+
if (this.isMultiplayerGame) {
|
|
522
|
+
if (scores.length === 1) {
|
|
523
|
+
// Multiplayer special case: Only one player scored
|
|
524
|
+
const score = scores[0];
|
|
525
|
+
score.str = "P" + score.player + ":" + score.value;
|
|
526
|
+
this.image.printCenter(
|
|
527
|
+
score.str,
|
|
528
|
+
currY,
|
|
529
|
+
screenColor(1),
|
|
530
|
+
image.font5
|
|
531
|
+
);
|
|
532
|
+
if (score.winner) {
|
|
533
|
+
// In multiplayer, the winning score gets a trophy
|
|
534
|
+
const x = (this.image.width >> 1) - ((score.str.length * image.font5.charWidth) >> 1);
|
|
535
|
+
this.image.drawTransparentImage(img_trophy_sm, x - img_trophy_sm.width - 3, currY - 2);
|
|
536
|
+
}
|
|
537
|
+
} else {
|
|
538
|
+
// Multiplayer general case: Multiple players scored
|
|
539
|
+
// Compute max score width
|
|
540
|
+
const strlens = [0, 0];
|
|
541
|
+
for (let i = 0; i < scores.length; ++i) {
|
|
542
|
+
const col = i % 2;
|
|
543
|
+
const score = scores[i];
|
|
544
|
+
score.str = "P" + score.player + ":" + score.value;
|
|
545
|
+
strlens[col] = Math.max(strlens[col], score.str.length);
|
|
546
|
+
}
|
|
547
|
+
// Print scores in a grid, two per row
|
|
548
|
+
for (let i = 0; i < scores.length; ++i) {
|
|
549
|
+
const col = i % 2;
|
|
550
|
+
const score = scores[i];
|
|
551
|
+
let str = padStr(strlens[col]);
|
|
552
|
+
str = replaceRange(str, score.str, 0, score.str.length);
|
|
553
|
+
let x = 0;
|
|
554
|
+
if (col === 0) {
|
|
555
|
+
x = (this.image.width >> 1) - strlens[col] * image.font5.charWidth - 3;
|
|
556
|
+
} else {
|
|
557
|
+
x = (this.image.width >> 1) + 3;
|
|
558
|
+
}
|
|
559
|
+
if (score.winner) {
|
|
560
|
+
// In multiplayer, the winning score gets a trophy
|
|
561
|
+
if (i % 2 === 0) {
|
|
562
|
+
this.image.drawTransparentImage(img_trophy_sm, x - img_trophy_sm.width - 3, currY - 2);
|
|
563
|
+
} else {
|
|
564
|
+
this.image.drawTransparentImage(img_trophy_sm, x + score.str.length * image.font5.charWidth + 2, currY - 2);
|
|
565
|
+
}
|
|
566
|
+
}
|
|
567
|
+
this.image.print(
|
|
568
|
+
str,
|
|
569
|
+
x,
|
|
570
|
+
currY,
|
|
571
|
+
screenColor(1),
|
|
572
|
+
image.font5
|
|
573
|
+
);
|
|
574
|
+
if (i % 2 === 1) {
|
|
575
|
+
currY += image.font5.charHeight + 2;
|
|
576
|
+
}
|
|
577
|
+
}
|
|
578
|
+
}
|
|
579
|
+
} else {
|
|
580
|
+
// Single player case
|
|
581
|
+
const score = scores[0];
|
|
582
|
+
score.str = "Score:" + score.value;
|
|
583
|
+
this.image.printCenter(
|
|
584
|
+
score.str,
|
|
585
|
+
currY - 1,
|
|
586
|
+
screenColor(1),
|
|
587
|
+
image.font8 // Single player score gets a bigger font
|
|
588
|
+
);
|
|
589
|
+
}
|
|
590
|
+
} else if (this.isWinCondition) {
|
|
591
|
+
// No score, but there is a win condition. Show a trophy.
|
|
592
|
+
let currY = image.font5.charHeight + 14;
|
|
593
|
+
this.image.drawTransparentImage(img_trophy_lg, (this.image.width >> 1) - (img_trophy_lg.width >> 1), currY);
|
|
594
|
+
} else {
|
|
595
|
+
// No score, no win, show a generic game over icon (sleepy sim)
|
|
596
|
+
let currY = image.font5.charHeight + 14;
|
|
597
|
+
this.image.drawTransparentImage(img_sleepy_sim, (this.image.width >> 1) - (img_sleepy_sim.width >> 1), currY);
|
|
598
|
+
}
|
|
599
|
+
}
|
|
382
600
|
|
|
383
|
-
|
|
601
|
+
drawBestScore() {
|
|
602
|
+
if (this.hasBestScore) {
|
|
603
|
+
const currY = this.height - image.font8.charHeight - 5;
|
|
604
|
+
if (this.isNewBestScore) {
|
|
605
|
+
const label = "New Best Score!";
|
|
384
606
|
this.image.printCenter(
|
|
385
|
-
|
|
386
|
-
|
|
387
|
-
|
|
388
|
-
image.
|
|
607
|
+
label,
|
|
608
|
+
currY,
|
|
609
|
+
screenColor(9),
|
|
610
|
+
image.font8
|
|
389
611
|
);
|
|
612
|
+
// In single player draw trophy icons on either side of the label.
|
|
613
|
+
// In multiplayer a trophy icon is drawn next to the winning score instead.
|
|
614
|
+
if (!this.isMultiplayerGame) {
|
|
615
|
+
const halfWidth = (label.length * image.font8.charWidth) >> 1;
|
|
616
|
+
this.image.drawTransparentImage(img_trophy_sm, (this.image.width >> 1) - halfWidth - img_trophy_sm.width - 2, currY);
|
|
617
|
+
this.image.drawTransparentImage(img_trophy_sm, (this.image.width >> 1) + halfWidth, currY);
|
|
618
|
+
}
|
|
390
619
|
} else {
|
|
391
620
|
this.image.printCenter(
|
|
392
|
-
"
|
|
393
|
-
|
|
394
|
-
|
|
621
|
+
"Best:" + this.bestScore,
|
|
622
|
+
currY,
|
|
623
|
+
screenColor(9),
|
|
395
624
|
image.font8
|
|
396
625
|
);
|
|
397
626
|
}
|
|
398
627
|
}
|
|
399
628
|
}
|
|
629
|
+
|
|
630
|
+
drawTextCore() {
|
|
631
|
+
this.drawMessage();
|
|
632
|
+
this.drawScores();
|
|
633
|
+
this.drawBestScore();
|
|
634
|
+
}
|
|
400
635
|
}
|
|
401
636
|
|
|
402
637
|
/**
|
|
@@ -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___P48685(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___48928 = (undefined);
|
|
70
|
+
globals._pollEventQueue___48941 = (undefined);
|
|
71
71
|
r0 = undefined;
|
|
72
72
|
return leave(s, r0)
|
|
73
73
|
default: oops()
|
|
74
74
|
} } }
|
|
75
|
-
|
|
76
|
-
|
|
75
|
+
_main___P48685.info = {"start":0,"length":0,"line":0,"column":0,"endLine":0,"endColumn":0,"fileName":"characterlcd.ts","functionName":"<main>","argumentNames":[]}
|
|
76
|
+
_main___P48685.continuations = [ ]
|
|
77
77
|
|
|
78
|
-
function
|
|
78
|
+
function _main___P48685_mk(s) {
|
|
79
79
|
checkStack(s.depth);
|
|
80
80
|
return {
|
|
81
|
-
parent: s, fn:
|
|
81
|
+
parent: s, fn: _main___P48685, 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___P48571_mk(s) {
|
|
|
88
88
|
|
|
89
89
|
const breakpoints = setupDebugger(1, [])
|
|
90
90
|
|
|
91
|
-
return
|
|
91
|
+
return _main___P48685
|
|
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___P98387(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___98630 = (undefined);
|
|
70
|
+
globals._pollEventQueue___98643 = (undefined);
|
|
71
71
|
r0 = undefined;
|
|
72
72
|
return leave(s, r0)
|
|
73
73
|
default: oops()
|
|
74
74
|
} } }
|
|
75
|
-
|
|
76
|
-
|
|
75
|
+
_main___P98387.info = {"start":0,"length":0,"line":0,"column":0,"endLine":0,"endColumn":0,"fileName":"tsl2591.ts","functionName":"<main>","argumentNames":[]}
|
|
76
|
+
_main___P98387.continuations = [ ]
|
|
77
77
|
|
|
78
|
-
function
|
|
78
|
+
function _main___P98387_mk(s) {
|
|
79
79
|
checkStack(s.depth);
|
|
80
80
|
return {
|
|
81
|
-
parent: s, fn:
|
|
81
|
+
parent: s, fn: _main___P98387, 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___P98045_mk(s) {
|
|
|
88
88
|
|
|
89
89
|
const breakpoints = setupDebugger(1, [])
|
|
90
90
|
|
|
91
|
-
return
|
|
91
|
+
return _main___P98387
|
|
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___P59987(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___60230 = (undefined);
|
|
70
|
+
globals._pollEventQueue___60243 = (undefined);
|
|
71
71
|
r0 = undefined;
|
|
72
72
|
return leave(s, r0)
|
|
73
73
|
default: oops()
|
|
74
74
|
} } }
|
|
75
|
-
|
|
76
|
-
|
|
75
|
+
_main___P59987.info = {"start":0,"length":0,"line":0,"column":0,"endLine":0,"endColumn":0,"fileName":"lora.ts","functionName":"<main>","argumentNames":[]}
|
|
76
|
+
_main___P59987.continuations = [ ]
|
|
77
77
|
|
|
78
|
-
function
|
|
78
|
+
function _main___P59987_mk(s) {
|
|
79
79
|
checkStack(s.depth);
|
|
80
80
|
return {
|
|
81
|
-
parent: s, fn:
|
|
81
|
+
parent: s, fn: _main___P59987, 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___P59873_mk(s) {
|
|
|
88
88
|
|
|
89
89
|
const breakpoints = setupDebugger(1, [])
|
|
90
90
|
|
|
91
|
-
return
|
|
91
|
+
return _main___P59987
|
|
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___P191315(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___191558 = (undefined);
|
|
70
|
+
globals._pollEventQueue___191571 = (undefined);
|
|
71
71
|
r0 = undefined;
|
|
72
72
|
return leave(s, r0)
|
|
73
73
|
default: oops()
|
|
74
74
|
} } }
|
|
75
|
-
|
|
76
|
-
|
|
75
|
+
_main___P191315.info = {"start":0,"length":0,"line":0,"column":0,"endLine":0,"endColumn":0,"fileName":"keypad.ts","functionName":"<main>","argumentNames":[]}
|
|
76
|
+
_main___P191315.continuations = [ ]
|
|
77
77
|
|
|
78
|
-
function
|
|
78
|
+
function _main___P191315_mk(s) {
|
|
79
79
|
checkStack(s.depth);
|
|
80
80
|
return {
|
|
81
|
-
parent: s, fn:
|
|
81
|
+
parent: s, fn: _main___P191315, 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___P190517_mk(s) {
|
|
|
88
88
|
|
|
89
89
|
const breakpoints = setupDebugger(1, [])
|
|
90
90
|
|
|
91
|
-
return
|
|
91
|
+
return _main___P191315
|
|
92
92
|
})
|