pxt-arcade 1.12.2 → 1.12.3
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/target.js +148 -143
- package/built/target.json +148 -143
- package/built/targetlight.json +5 -5
- package/built/theme.json +5 -0
- package/docs/SUMMARY.md +1 -0
- package/docs/hero-banner.md +6 -6
- package/docs/hour-of-code-2022-es.html +1 -1
- package/docs/hour-of-code-2022-pt.html +0 -1
- package/docs/hour-of-code-2022.html +15 -12
- package/docs/index-ref.json +1 -1
- package/docs/kiosk.html +1 -1
- package/docs/multiplayer.md +135 -0
- package/docs/projects/SUMMARY.md +3 -1
- package/docs/skillmap/balloon/balloon1.md +26 -312
- package/docs/skillmap/balloon/balloon2.md +18 -315
- package/docs/skillmap/balloon/balloon3.md +18 -317
- package/docs/skillmap/balloon/balloon4.md +105 -583
- package/docs/skillmap/balloon.md +14 -13
- package/docs/skillmap/mole/mole1.md +51 -326
- package/docs/skillmap/mole/mole2.md +43 -332
- package/docs/skillmap/mole/mole3.md +47 -316
- package/docs/{test/skillmap → skillmap}/mole/mole4.md +0 -0
- package/docs/skillmap/mole.md +14 -4
- package/docs/skillmap/turkey/turkey1.md +194 -127
- package/docs/skillmap/turkey/turkey2.md +144 -96
- package/docs/skillmap/turkey/turkey3.md +135 -84
- package/docs/skillmap/turkey.md +12 -10
- package/docs/skillmaps.md +24 -8
- package/docs/static/kiosk/asset-manifest.json +6 -6
- package/docs/static/kiosk/static/css/main.8897f977.css +2 -0
- package/docs/static/kiosk/static/css/main.8897f977.css.map +1 -0
- package/docs/static/kiosk/static/js/main.f11fd683.js +3 -0
- package/docs/static/kiosk/static/js/{main.01c7792a.js.LICENSE.txt → main.f11fd683.js.LICENSE.txt} +12 -32
- package/docs/static/kiosk/static/js/main.f11fd683.js.map +1 -0
- package/docs/static/multiplayer/help/emojis.png +0 -0
- package/docs/static/multiplayer/help/host-multiplayer.png +0 -0
- package/docs/static/multiplayer/help/hosted-game.png +0 -0
- package/docs/static/multiplayer/help/join-game.png +0 -0
- package/docs/static/multiplayer/help/joined-game.png +0 -0
- package/docs/static/multiplayer/help/share-button.png +0 -0
- package/docs/static/multiplayer/help/start-game.png +0 -0
- package/docs/static/skillmap/assets/dkc-logo-small.png +0 -0
- package/docs/static/tutorials/arrows/2pbg.png +0 -0
- package/docs/static/tutorials/arrows/key.png +0 -0
- package/docs/static/tutorials/arrows/p1.png +0 -0
- package/docs/static/tutorials/arrows/p2.png +0 -0
- package/docs/static/tutorials/horse/finish.png +0 -0
- package/docs/static/tutorials/horse/frame.png +0 -0
- package/docs/static/tutorials/horse/p1.png +0 -0
- package/docs/static/tutorials/horse/p2.png +0 -0
- package/docs/test/skillmap/balloon.md +1 -1
- package/docs/test/skillmap/dino/{collectort1.md → dino1.md} +135 -79
- package/docs/test/skillmap/dino/{collectort2.md → dino2.md} +0 -0
- package/docs/test/skillmap/dino/{collectort3.md → dino3.md} +0 -0
- package/docs/test/skillmap/dino/{collectort4.md → dino4.md} +0 -0
- package/docs/test/skillmap/dino/{collectort5.md → dino5.md} +0 -0
- package/docs/test/skillmap/dino.md +82 -0
- package/docs/test/skillmap/mole.md +1 -1
- package/docs/test/skillmap/turkey.md +1 -0
- package/docs/test/tutorials/arrow.md +677 -0
- package/docs/test/tutorials/debug.md +180 -0
- package/docs/test/tutorials/horse.md +456 -0
- package/docs/test/tutorials/hundred.md +417 -0
- package/docs/test/tutorials/target.md +6 -2
- package/docs/test/tutorials/wakanda-forever.md +191 -172
- package/docs/tutorials/arrow.md +677 -0
- package/docs/tutorials/horse.md +456 -0
- package/docs/{test/tutorials/target/target_copy.md → tutorials/target.md} +11 -1085
- package/docs/tutorials/wakanda-forever.md +3 -1
- package/package.json +2 -2
- package/docs/skillmap/turkey/turkey0.md +0 -197
- package/docs/skillmap/turkey/turkey1a.md +0 -308
- package/docs/skillmap/turkey/turkey2a.md +0 -277
- package/docs/skillmap/turkey/turkey3a.md +0 -219
- package/docs/static/kiosk/static/css/main.927f4dad.css +0 -2
- package/docs/static/kiosk/static/css/main.927f4dad.css.map +0 -1
- package/docs/static/kiosk/static/js/main.01c7792a.js +0 -3
- package/docs/static/kiosk/static/js/main.01c7792a.js.map +0 -1
- package/docs/test/skillmap/balloon/balloon1.md +0 -247
- package/docs/test/skillmap/balloon/balloon2.md +0 -377
- package/docs/test/skillmap/balloon/balloon3.md +0 -389
- package/docs/test/skillmap/balloon/balloon4.md +0 -385
- package/docs/test/skillmap/mole/mole1.md +0 -382
- package/docs/test/skillmap/mole/mole2.md +0 -422
- package/docs/test/skillmap/mole/mole3.md +0 -384
- package/docs/test/skillmap/turkey/turkey1.md +0 -338
- package/docs/test/skillmap/turkey/turkey2.md +0 -318
- package/docs/test/skillmap/turkey/turkey3.md +0 -265
|
@@ -82,7 +82,7 @@ We need to be able to move the hammer around the screen to chase the mole.
|
|
|
82
82
|
|
|
83
83
|
- :game: From the ``||controller: Controller||`` category, grab <br/>
|
|
84
84
|
```block
|
|
85
|
-
controller.
|
|
85
|
+
controller.moveOnlyOnscreenWithArrows(myHammer, controller.Speeds.Fast)
|
|
86
86
|
```
|
|
87
87
|
and snap it in at **the end** of the ``||loops(noclick): on start||`` block already in the workspace.
|
|
88
88
|
|
|
@@ -107,7 +107,7 @@ scene.setBackgroundImage(assets.image`grid`)
|
|
|
107
107
|
myMole = sprites.create(assets.image`mole`, SpriteKind.Enemy)
|
|
108
108
|
myHammer = sprites.create(assets.image`hammer`, SpriteKind.Player)
|
|
109
109
|
//@highlight
|
|
110
|
-
controller.
|
|
110
|
+
controller.moveOnlyOnscreenWithArrows(myHammer, controller.Speeds.Fast)
|
|
111
111
|
```
|
|
112
112
|
|
|
113
113
|
|
|
@@ -116,7 +116,7 @@ controller.move_only_onscreen_with_arrows(myHammer, speeds.Fast)
|
|
|
116
116
|
|
|
117
117
|
- :binoculars: Test your project in the game window to see how it works!
|
|
118
118
|
|
|
119
|
-
Try using the on-screen joypad (or the arrow keys on your keyboard) to move the hammer around the screen.
|
|
119
|
+
Try using the on-screen joypad **(or the arrow keys on your keyboard)** to move the hammer around the screen.
|
|
120
120
|
|
|
121
121
|
|
|
122
122
|
|
|
@@ -165,6 +165,7 @@ sprites.onOverlap(SpriteKind.Player, SpriteKind.Enemy, function (sprite, otherSp
|
|
|
165
165
|
|
|
166
166
|
- :binoculars: Play with your project in the game window!
|
|
167
167
|
|
|
168
|
+
Use the on-screen joypad **(or the arrow keys on your keyboard)** to move the hammer.
|
|
168
169
|
|
|
169
170
|
When your rubber hammer overlaps the mole, you should see points start to show up in the top-right corner.
|
|
170
171
|
|
|
@@ -180,7 +181,7 @@ Did you notice that the points added up really quickly when the rubber hammer st
|
|
|
180
181
|
- :paper plane: From the ``||sprites: Sprites||`` category, grab <br/>
|
|
181
182
|
|
|
182
183
|
```block
|
|
183
|
-
sprites.
|
|
184
|
+
sprites.moveToRandomHoleOnGrid(myMole)
|
|
184
185
|
```
|
|
185
186
|
|
|
186
187
|
and snap it into **the end** of the ``||sprites(noclick): on sprite overlaps otherSprite||`` block container already in the workspace.
|
|
@@ -203,7 +204,7 @@ hint~
|
|
|
203
204
|
sprites.onOverlap(SpriteKind.Player, SpriteKind.Enemy, function (sprite, otherSprite) {
|
|
204
205
|
info.changeScoreBy(1)
|
|
205
206
|
//@highlight
|
|
206
|
-
sprites.
|
|
207
|
+
sprites.moveToRandomHoleOnGrid(myMole)
|
|
207
208
|
})
|
|
208
209
|
```
|
|
209
210
|
|
|
@@ -215,10 +216,10 @@ sprites.onOverlap(SpriteKind.Player, SpriteKind.Enemy, function (sprite, otherSp
|
|
|
215
216
|
Finally, let's add a timer to keep the game exciting.
|
|
216
217
|
|
|
217
218
|
|
|
218
|
-
- :id card: From the ``||
|
|
219
|
+
- :id card: From the ``||carnival: Carnival||`` category, grab <br/>
|
|
219
220
|
|
|
220
221
|
```block
|
|
221
|
-
|
|
222
|
+
carnival.startCountdownGame(15, carnival.WinTypes.Score)
|
|
222
223
|
```
|
|
223
224
|
|
|
224
225
|
and snap it into **the end** of the <br/>
|
|
@@ -243,9 +244,9 @@ let myHammer: Sprite = null
|
|
|
243
244
|
scene.setBackgroundImage(assets.image`grid`)
|
|
244
245
|
myMole = sprites.create(assets.image`mole`, SpriteKind.Enemy)
|
|
245
246
|
myHammer = sprites.create(assets.image`hammer`, SpriteKind.Player)
|
|
246
|
-
controller.
|
|
247
|
+
controller.moveOnlyOnscreenWithArrows(myHammer, controller.Speeds.Fast)
|
|
247
248
|
//@highlight
|
|
248
|
-
|
|
249
|
+
carnival.startCountdownGame(15, carnival.WinTypes.Score)
|
|
249
250
|
```
|
|
250
251
|
|
|
251
252
|
|
|
@@ -283,12 +284,14 @@ When you're ready, click **Done** to return to the skillmap so you can add sound
|
|
|
283
284
|
```blockconfig.global
|
|
284
285
|
let myHammer = sprites.create(img`.`, SpriteKind.Player)
|
|
285
286
|
sprites.onOverlap(SpriteKind.Player, SpriteKind.Enemy, function (sprite, otherSprite) { info.changeScoreBy(1) })
|
|
287
|
+
carnival.startCountdownGame(15, carnival.WinTypes.Score)
|
|
286
288
|
```
|
|
287
289
|
|
|
288
290
|
|
|
291
|
+
|
|
289
292
|
```package
|
|
290
|
-
simple-blocks=github:microsoft/arcade-tutorial-extensions/simple-blocks
|
|
291
|
-
|
|
293
|
+
simple-blocks=github:microsoft/arcade-tutorial-extensions/simple-blocks
|
|
294
|
+
carnival=github:microsoft/arcade-carnival
|
|
292
295
|
```
|
|
293
296
|
|
|
294
297
|
|
|
@@ -299,94 +302,25 @@ scene.setBackgroundImage(assets.image`grid`)
|
|
|
299
302
|
myMole = sprites.create(assets.image`mole`, SpriteKind.Enemy)
|
|
300
303
|
|
|
301
304
|
game.onUpdateInterval(1000, function () {
|
|
302
|
-
sprites.
|
|
305
|
+
sprites.moveToRandomHoleOnGrid(myMole)
|
|
303
306
|
})
|
|
304
307
|
```
|
|
305
308
|
|
|
306
309
|
|
|
307
310
|
|
|
308
|
-
|
|
309
311
|
```customts
|
|
310
312
|
|
|
311
|
-
|
|
312
|
-
//% block="win game"
|
|
313
|
-
Win,
|
|
314
|
-
//% block="lose game"
|
|
315
|
-
Lose,
|
|
316
|
-
//% block="high score"
|
|
317
|
-
Score,
|
|
318
|
-
//% block="multiplayer"
|
|
319
|
-
Multi
|
|
320
|
-
}
|
|
321
|
-
|
|
322
|
-
enum speeds {
|
|
323
|
-
//% block="fast"
|
|
324
|
-
Fast,
|
|
325
|
-
//% block="medium"
|
|
326
|
-
Med,
|
|
327
|
-
//% block="slow"
|
|
328
|
-
Slow
|
|
329
|
-
}
|
|
330
|
-
|
|
331
|
-
enum areas {
|
|
332
|
-
//% block="top"
|
|
333
|
-
Top,
|
|
334
|
-
//% block="middle"
|
|
335
|
-
Mid,
|
|
336
|
-
//% block="bottom"
|
|
337
|
-
Bottom
|
|
338
|
-
}
|
|
339
|
-
|
|
340
|
-
let textSprite: TextSprite = null
|
|
341
|
-
//let fanfare: effects.BackgroundEffect = undefined;
|
|
342
|
-
//let winStyle = winTypes.Score
|
|
343
|
-
|
|
344
|
-
|
|
345
|
-
|
|
346
|
-
namespace animation {
|
|
347
|
-
/**
|
|
348
|
-
* Prefills animation block with hammer items
|
|
349
|
-
*/
|
|
350
|
-
//% color="#03aa74"
|
|
351
|
-
//% blockId=run-image-animation-hammer
|
|
352
|
-
//% block="animate $sprite=variables_get(myHammer) frames $frames=animation_editor interval (ms) $frameInterval=timePicker loop $loop=toggleOnOff"
|
|
353
|
-
//% frameInterval.defl=100
|
|
354
|
-
//% group="Animate"
|
|
355
|
-
//% weight=100
|
|
356
|
-
//% help=animation/run-image-animation-hammer
|
|
357
|
-
export function runImageAnimationHammer(sprite: Sprite, frames: Image[], frameInterval?: number, loop?: boolean) {
|
|
358
|
-
const anim = new ImageAnimation(sprite, frames, frameInterval || 100, !!loop);
|
|
359
|
-
anim.init();
|
|
360
|
-
}
|
|
361
|
-
}
|
|
362
|
-
|
|
363
|
-
|
|
313
|
+
namespace controller{
|
|
364
314
|
|
|
365
|
-
|
|
366
|
-
|
|
367
|
-
|
|
368
|
-
|
|
369
|
-
|
|
370
|
-
|
|
371
|
-
|
|
372
|
-
//% block="add label $myLabel to $myPosition of window || $myColor"
|
|
373
|
-
//% myLabel.defl="Whack-the-Mole"
|
|
374
|
-
//% myColor.shadow="colorindexpicker"
|
|
375
|
-
//% myColor.defl=4
|
|
376
|
-
//% myPosition.defl=areas.Bottom
|
|
377
|
-
//% inlineInputMode=inline
|
|
378
|
-
export function add_label_to(myLabel: string, myPosition: areas, myColor?:number) {
|
|
379
|
-
if (!myColor)
|
|
380
|
-
myColor = 4;
|
|
381
|
-
|
|
382
|
-
textSprite = textsprite.create(myLabel, 0, myColor)
|
|
383
|
-
if (myPosition == areas.Bottom) textSprite.setPosition(80, 110);
|
|
384
|
-
if (myPosition == areas.Mid) textSprite.setPosition(80, 50);
|
|
385
|
-
if (myPosition == areas.Top) textSprite.setPosition(80, 20);
|
|
315
|
+
export enum Speeds {
|
|
316
|
+
//% block="fast"
|
|
317
|
+
Fast,
|
|
318
|
+
//% block="medium"
|
|
319
|
+
Med,
|
|
320
|
+
//% block="slow"
|
|
321
|
+
Slow
|
|
386
322
|
}
|
|
387
|
-
}
|
|
388
323
|
|
|
389
|
-
namespace controller{
|
|
390
324
|
|
|
391
325
|
/**
|
|
392
326
|
* Combines a simple "move with arrows"
|
|
@@ -395,13 +329,13 @@ namespace controller{
|
|
|
395
329
|
//% color="#d54322"
|
|
396
330
|
//% blockId=move_only_onscreen_with_arrows
|
|
397
331
|
//% block="move $thisSprite=variables_get(myHammer) on screen with speed $mySpeed"
|
|
398
|
-
//% mySpeed.defl=
|
|
332
|
+
//% mySpeed.defl=Speeds.Fast
|
|
399
333
|
//% inlineInputMode=inline
|
|
400
|
-
export function
|
|
334
|
+
export function moveOnlyOnscreenWithArrows(thisSprite: Sprite, mySpeed: Speeds) {
|
|
401
335
|
thisSprite.setStayInScreen(true)
|
|
402
|
-
if (mySpeed ==
|
|
336
|
+
if (mySpeed == Speeds.Fast) {
|
|
403
337
|
controller.moveSprite(thisSprite, 225, 225)
|
|
404
|
-
} else if (mySpeed ==
|
|
338
|
+
} else if (mySpeed == Speeds.Med) {
|
|
405
339
|
controller.moveSprite(thisSprite, 175, 175)
|
|
406
340
|
} else {
|
|
407
341
|
controller.moveSprite(thisSprite, 100, 100)
|
|
@@ -419,251 +353,17 @@ namespace sprites {
|
|
|
419
353
|
//% blockId=move_to_random_hole_on_grid
|
|
420
354
|
//% block="move sprite $thisSprite=variables_get(myMole) to random area"
|
|
421
355
|
//% inlineInputMode=inline
|
|
422
|
-
export function
|
|
356
|
+
export function moveToRandomHoleOnGrid(thisSprite: Sprite) {
|
|
423
357
|
thisSprite.setPosition(simplified.chooseRandomNumber(28, 80, 130), simplified.chooseRandomNumber(21, 53, 85))
|
|
358
|
+
simplified.still = 0;
|
|
424
359
|
}
|
|
425
360
|
}
|
|
426
361
|
|
|
427
|
-
namespace info {
|
|
428
|
-
let countdownInitialized = false;
|
|
429
|
-
/**
|
|
430
|
-
* Adds game end style to countdown
|
|
431
|
-
*/
|
|
432
|
-
//% color="#cf6a87"
|
|
433
|
-
//% group=countdown
|
|
434
|
-
//% blockId=start_countdown_game
|
|
435
|
-
//% block="start countdown $myTime (s) and game over $winType || effect $winEffect"
|
|
436
|
-
//% myTime.defl=15
|
|
437
|
-
//% winType.defl=winTypes.Score
|
|
438
|
-
//% winEffect.defl=effects.confetti
|
|
439
|
-
//% inlineInputMode=inline
|
|
440
|
-
export function startCountdownGame(myTime: number, winType: winTypes, winEffect?: effects.BackgroundEffect) {
|
|
441
|
-
if (!winType)
|
|
442
|
-
winType = winTypes.Win;
|
|
443
|
-
if (!winEffect && winType != winTypes.Lose){
|
|
444
|
-
winEffect = effects.confetti;
|
|
445
|
-
}
|
|
446
|
-
else { winEffect = effects.melt;}
|
|
447
|
-
init(winType, winEffect);
|
|
448
|
-
info.startCountdown(myTime)
|
|
449
|
-
|
|
450
|
-
}
|
|
451
|
-
|
|
452
|
-
export function newGameOver(winStyle: winTypes, fanfare: effects.BackgroundEffect) {
|
|
453
|
-
|
|
454
|
-
// Prep default variables for different win types
|
|
455
|
-
let winnerNumber = 1;
|
|
456
|
-
let thisHigh = 0;
|
|
457
|
-
|
|
458
|
-
// Save all scores as relevant to the game.
|
|
459
|
-
info.saveAllScores();
|
|
460
|
-
|
|
461
|
-
// collect the scores before popping the scenes
|
|
462
|
-
const scoreInfo1 = info.player1.getState();
|
|
463
|
-
const scoreInfo2 = info.player2.getState();
|
|
464
|
-
const scoreInfo3 = info.player3.getState();
|
|
465
|
-
const scoreInfo4 = info.player4.getState();
|
|
466
|
-
const highScore = info.highScore();
|
|
467
|
-
const allScores = [scoreInfo1.score, scoreInfo2.score, scoreInfo3.score, scoreInfo4.score];
|
|
468
|
-
|
|
469
|
-
// Find player with highest score
|
|
470
|
-
for (let i = 0; i < 4; i++) {
|
|
471
|
-
if (allScores[i] > thisHigh) {
|
|
472
|
-
thisHigh = allScores[i];
|
|
473
|
-
winnerNumber = i+1;
|
|
474
|
-
}
|
|
475
|
-
}
|
|
476
|
-
// If highest score is higher than saved high, replace
|
|
477
|
-
if (thisHigh > highScore){
|
|
478
|
-
info.saveHighScore(); }
|
|
479
|
-
|
|
480
|
-
|
|
481
|
-
// releasing memory and clear fibers. Do not add anything that releases the fiber until background is set below,
|
|
482
|
-
// or screen will be cleared on the new frame and will not appear as background in the game over screen.
|
|
483
|
-
game.popScene();
|
|
484
|
-
game.pushScene();
|
|
485
|
-
scene.setBackgroundImage(screen.clone());
|
|
486
|
-
|
|
487
|
-
music.powerUp.play();
|
|
488
362
|
|
|
489
|
-
|
|
490
|
-
|
|
491
|
-
pause(400);
|
|
492
|
-
|
|
493
|
-
const overDialog = new GameOverDialog(true, thisHigh, highScore, winnerNumber, winStyle);
|
|
494
|
-
scene.createRenderable(scene.HUD_Z, target => {
|
|
495
|
-
overDialog.update();
|
|
496
|
-
target.drawTransparentImage(
|
|
497
|
-
overDialog.image,
|
|
498
|
-
0,
|
|
499
|
-
(screen.height - overDialog.image.height) >> 1
|
|
500
|
-
);
|
|
501
|
-
});
|
|
502
|
-
pause(500); // wait for users to stop pressing keys
|
|
503
|
-
overDialog.displayCursor();
|
|
504
|
-
game.waitAnyButton();
|
|
505
|
-
control.reset();
|
|
506
|
-
|
|
507
|
-
}
|
|
508
|
-
|
|
509
|
-
function init(winStyle: winTypes, fanfare: effects.BackgroundEffect) {
|
|
510
|
-
if (countdownInitialized) return;
|
|
511
|
-
countdownInitialized = true;
|
|
512
|
-
|
|
513
|
-
info.onCountdownEnd(function () {
|
|
514
|
-
if (winStyle == winTypes.Win) {
|
|
515
|
-
game.over(true, fanfare)
|
|
516
|
-
} else if (winStyle == winTypes.Lose) {
|
|
517
|
-
game.over(false, fanfare)
|
|
518
|
-
} else {
|
|
519
|
-
newGameOver(winStyle, fanfare);
|
|
520
|
-
}
|
|
521
|
-
})
|
|
522
|
-
}
|
|
523
|
-
|
|
524
|
-
export class GameOverDialog extends game.BaseDialog {
|
|
525
|
-
protected cursorOn: boolean;
|
|
526
|
-
protected isNewHighScore: boolean;
|
|
527
|
-
|
|
528
|
-
constructor(
|
|
529
|
-
protected win: boolean,
|
|
530
|
-
protected score?: number,
|
|
531
|
-
protected highScore?: number,
|
|
532
|
-
protected winnerNum?: number,
|
|
533
|
-
protected winStyle?: winTypes
|
|
534
|
-
) {
|
|
535
|
-
super(screen.width, 46, img`
|
|
536
|
-
1 1 1
|
|
537
|
-
f f f
|
|
538
|
-
1 1 1
|
|
539
|
-
`);
|
|
540
|
-
this.cursorOn = false;
|
|
541
|
-
this.isNewHighScore = this.score > this.highScore;
|
|
542
|
-
}
|
|
543
|
-
|
|
544
|
-
displayCursor() {
|
|
545
|
-
this.cursorOn = true;
|
|
546
|
-
}
|
|
547
|
-
|
|
548
|
-
update() {
|
|
549
|
-
this.clearInterior();
|
|
550
|
-
this.drawTextCore();
|
|
551
|
-
|
|
552
|
-
if (this.cursorOn) {
|
|
553
|
-
this.drawCursorRow();
|
|
554
|
-
}
|
|
555
|
-
}
|
|
556
|
-
|
|
557
|
-
drawTextCore() {
|
|
558
|
-
const titleHeight = 8;
|
|
559
|
-
if (this.winStyle == winTypes.Multi){
|
|
560
|
-
this.image.printCenter(
|
|
561
|
-
"Player " + this.winnerNum + " wins!",
|
|
562
|
-
titleHeight,
|
|
563
|
-
screen.isMono ? 1 : 5,
|
|
564
|
-
image.font8
|
|
565
|
-
);
|
|
566
|
-
|
|
567
|
-
if (this.score !== undefined) {
|
|
568
|
-
const scoreHeight = 23;
|
|
569
|
-
const highScoreHeight = 34;
|
|
570
|
-
const scoreColor = screen.isMono ? 1 : 2;
|
|
571
|
-
|
|
572
|
-
this.image.printCenter(
|
|
573
|
-
"Score:" + this.score,
|
|
574
|
-
scoreHeight,
|
|
575
|
-
scoreColor,
|
|
576
|
-
image.font8
|
|
577
|
-
);
|
|
578
|
-
|
|
579
|
-
if (this.isNewHighScore) {
|
|
580
|
-
this.image.printCenter(
|
|
581
|
-
"New High Score!",
|
|
582
|
-
highScoreHeight,
|
|
583
|
-
scoreColor,
|
|
584
|
-
image.font5
|
|
585
|
-
);
|
|
586
|
-
} else {
|
|
587
|
-
this.image.printCenter(
|
|
588
|
-
"HI:" + this.highScore,
|
|
589
|
-
highScoreHeight,
|
|
590
|
-
scoreColor,
|
|
591
|
-
image.font8
|
|
592
|
-
);
|
|
593
|
-
}
|
|
594
|
-
}
|
|
595
|
-
}
|
|
596
|
-
else {
|
|
597
|
-
this.image.printCenter(
|
|
598
|
-
"Great Job!",
|
|
599
|
-
titleHeight,
|
|
600
|
-
screen.isMono ? 1 : 5,
|
|
601
|
-
image.font8
|
|
602
|
-
);
|
|
603
|
-
|
|
604
|
-
if (this.score !== undefined) {
|
|
605
|
-
const scoreHeight = 23;
|
|
606
|
-
const highScoreHeight = 34;
|
|
607
|
-
const scoreColor = screen.isMono ? 1 : 2;
|
|
608
|
-
|
|
609
|
-
this.image.printCenter(
|
|
610
|
-
"Score:" + this.score,
|
|
611
|
-
scoreHeight,
|
|
612
|
-
scoreColor,
|
|
613
|
-
image.font8
|
|
614
|
-
);
|
|
615
|
-
|
|
616
|
-
if (this.isNewHighScore) {
|
|
617
|
-
this.image.printCenter(
|
|
618
|
-
"New High Score!",
|
|
619
|
-
highScoreHeight,
|
|
620
|
-
scoreColor,
|
|
621
|
-
image.font5
|
|
622
|
-
);
|
|
623
|
-
} else {
|
|
624
|
-
this.image.printCenter(
|
|
625
|
-
"HI:" + this.highScore,
|
|
626
|
-
highScoreHeight,
|
|
627
|
-
scoreColor,
|
|
628
|
-
image.font8
|
|
629
|
-
);
|
|
630
|
-
}
|
|
631
|
-
}
|
|
632
|
-
}
|
|
633
|
-
}
|
|
634
|
-
}
|
|
635
|
-
}
|
|
636
|
-
|
|
637
|
-
namespace game {
|
|
638
|
-
/**
|
|
639
|
-
* Adds additional end game styles
|
|
640
|
-
*/
|
|
641
|
-
//% color="#8854d0"
|
|
642
|
-
//% group=Gameplay
|
|
643
|
-
//% blockId=on_game_over_expanded
|
|
644
|
-
//% block="game over $winStyle || add effect $winEffect"
|
|
645
|
-
//% winType.defl=winTypes.Win
|
|
646
|
-
//% winEffect.defl=effects.confetti
|
|
647
|
-
//% inlineInputMode=inline
|
|
648
|
-
export function onGameOverExpanded(winStyle: winTypes, winEffect?: effects.BackgroundEffect) {
|
|
649
|
-
if (!winStyle)
|
|
650
|
-
winStyle = winTypes.Win;
|
|
651
|
-
if (!winEffect && winStyle != winTypes.Lose) {
|
|
652
|
-
winEffect = effects.confetti;
|
|
653
|
-
}
|
|
654
|
-
else { winEffect = effects.melt; }
|
|
363
|
+
namespace simplified {
|
|
655
364
|
|
|
656
|
-
|
|
657
|
-
game.over(true, winEffect)
|
|
658
|
-
} else if (winStyle == winTypes.Lose) {
|
|
659
|
-
game.over(false, winEffect)
|
|
660
|
-
} else {
|
|
661
|
-
info.newGameOver(winStyle, winEffect);
|
|
662
|
-
}
|
|
663
|
-
}
|
|
664
|
-
}
|
|
365
|
+
export let still = 0;
|
|
665
366
|
|
|
666
|
-
namespace simplified {
|
|
667
367
|
/**
|
|
668
368
|
* Randomly chooses one of the parameter numbers
|
|
669
369
|
*
|
|
@@ -690,7 +390,18 @@ namespace simplified {
|
|
|
690
390
|
return myList._pickRandom();
|
|
691
391
|
}
|
|
692
392
|
|
|
393
|
+
/**
|
|
394
|
+
* Checks to see if mole has been moved since last time position was checked
|
|
395
|
+
*/
|
|
693
396
|
|
|
397
|
+
//% blockId=check_mole_escape
|
|
398
|
+
//% block="check if mole has escaped"
|
|
399
|
+
export function checkMoleEscape () {
|
|
400
|
+
if (still == 1) {
|
|
401
|
+
info.player2.changeScoreBy(1)
|
|
402
|
+
}
|
|
403
|
+
still = 1
|
|
404
|
+
}
|
|
694
405
|
|
|
695
406
|
}
|
|
696
407
|
|
|
@@ -708,4 +419,4 @@ namespace simplified {
|
|
|
708
419
|
"main.ts": "",
|
|
709
420
|
"pxt.json": "{\n \"name\": \"Whackem2 - Assets Only\",\n \"description\": \"\",\n \"dependencies\": {\n \"device\": \"*\"\n },\n \"files\": [\n \"main.blocks\",\n \"main.ts\",\n \"README.md\",\n \"assets.json\",\n \"images.g.jres\",\n \"images.g.ts\",\n \"custom.ts\"\n ],\n \"targetVersions\": {\n \"branch\": \"v1.8.26\",\n \"tag\": \"v1.8.26\",\n \"commits\": \"https://github.com/microsoft/pxt-arcade/commits/6434cb63948fe7c1d1a7498115a4bc495495512c\",\n \"target\": \"1.8.26\",\n \"pxt\": \"7.4.27\"\n },\n \"preferredEditor\": \"tsprj\"\n}\n"
|
|
710
421
|
}
|
|
711
|
-
```
|
|
422
|
+
```
|