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
|
@@ -42,10 +42,10 @@ hint~
|
|
|
42
42
|
|
|
43
43
|
**Let’s add a label to the bottom our Whack-the-Mole game booth.**
|
|
44
44
|
|
|
45
|
-
- :tree: From the ``||
|
|
45
|
+
- :tree: From the ``||carnival: Carnival||`` category in the toolbox, grab <br/>
|
|
46
46
|
|
|
47
47
|
```block
|
|
48
|
-
|
|
48
|
+
carnival.addLabelTo("Whack-the-Mole", carnival.Areas.Bottom)
|
|
49
49
|
```
|
|
50
50
|
|
|
51
51
|
and snap it inside and at the very **end** of the
|
|
@@ -72,10 +72,10 @@ let myHammer: Sprite = null
|
|
|
72
72
|
scene.setBackgroundImage(assets.image`grid`)
|
|
73
73
|
myMole = sprites.create(assets.image`mole`, SpriteKind.Enemy)
|
|
74
74
|
myHammer = sprites.create(assets.image`hammer`, SpriteKind.Player)
|
|
75
|
-
controller.
|
|
76
|
-
|
|
75
|
+
controller.moveOnlyOnscreenWithArrows(myHammer, controller.Speeds.Fast)
|
|
76
|
+
carnival.startCountdownGame(15, carnival.WinTypes.Score)
|
|
77
77
|
//@highlight
|
|
78
|
-
|
|
78
|
+
carnival.addLabelTo("Whack-the-Mole", carnival.Areas.Bottom)
|
|
79
79
|
```
|
|
80
80
|
|
|
81
81
|
|
|
@@ -113,7 +113,7 @@ sprites.onOverlap(SpriteKind.Player, SpriteKind.Enemy, function (sprite, otherSp
|
|
|
113
113
|
let myMole: Sprite = null
|
|
114
114
|
let myHammer: Sprite = null
|
|
115
115
|
info.changeScoreBy(1)
|
|
116
|
-
sprites.
|
|
116
|
+
sprites.moveToRandomHoleOnGrid(myMole)
|
|
117
117
|
//@highlight
|
|
118
118
|
music.knock.play()
|
|
119
119
|
|
|
@@ -184,7 +184,7 @@ sprites.onOverlap(SpriteKind.Player, SpriteKind.Enemy, function (sprite, otherSp
|
|
|
184
184
|
let myMole: Sprite = null
|
|
185
185
|
let myHammer: Sprite = null
|
|
186
186
|
info.changeScoreBy(1)
|
|
187
|
-
sprites.
|
|
187
|
+
sprites.moveToRandomHoleOnGrid(myMole)
|
|
188
188
|
music.knock.play()
|
|
189
189
|
//@highlight
|
|
190
190
|
animation.runImageAnimation(
|
|
@@ -215,11 +215,11 @@ When your rubber hammer overlaps the mole, points should show up in the top-righ
|
|
|
215
215
|
|
|
216
216
|
## {11. Finale}
|
|
217
217
|
|
|
218
|
-
**🎡
|
|
218
|
+
**🎡 You've done it! 🎡**
|
|
219
219
|
|
|
220
|
-
You've
|
|
220
|
+
You've created a Whack-the-Mole game!
|
|
221
221
|
|
|
222
|
-
When you're ready, click **Done** to return to the skillmap
|
|
222
|
+
When you're ready, click **Done** to return to the skillmap so you can turn it into a game for two players!
|
|
223
223
|
|
|
224
224
|
|
|
225
225
|
|
|
@@ -235,12 +235,16 @@ false
|
|
|
235
235
|
)
|
|
236
236
|
myHammer = sprites.create(img`.`, SpriteKind.Player)
|
|
237
237
|
sprites.onOverlap(SpriteKind.Player, SpriteKind.Enemy, function (sprite, otherSprite) { info.changeScoreBy(1) })
|
|
238
|
+
carnival.addLabelTo("Whack-the-Mole", carnival.Areas.Bottom)
|
|
239
|
+
carnival.startCountdownGame(15, carnival.WinTypes.Score)
|
|
240
|
+
|
|
238
241
|
```
|
|
239
242
|
|
|
240
243
|
|
|
244
|
+
|
|
241
245
|
```package
|
|
242
|
-
simple-blocks=github:microsoft/arcade-tutorial-extensions/simple-blocks
|
|
243
|
-
|
|
246
|
+
simple-blocks=github:microsoft/arcade-tutorial-extensions/simple-blocks
|
|
247
|
+
carnival=github:microsoft/arcade-carnival
|
|
244
248
|
```
|
|
245
249
|
|
|
246
250
|
|
|
@@ -248,7 +252,7 @@ arcade-text=github:microsoft/arcade-text/
|
|
|
248
252
|
|
|
249
253
|
sprites.onOverlap(SpriteKind.Player, SpriteKind.Enemy, function (sprite, otherSprite) {
|
|
250
254
|
info.changeScoreBy(1)
|
|
251
|
-
sprites.
|
|
255
|
+
sprites.moveToRandomHoleOnGrid(myMole)
|
|
252
256
|
|
|
253
257
|
})
|
|
254
258
|
let myMole: Sprite = null
|
|
@@ -256,79 +260,29 @@ let myHammer: Sprite = null
|
|
|
256
260
|
scene.setBackgroundImage(assets.image`grid`)
|
|
257
261
|
myMole = sprites.create(assets.image`mole`, SpriteKind.Enemy)
|
|
258
262
|
myHammer = sprites.create(assets.image`hammer`, SpriteKind.Player)
|
|
259
|
-
controller.
|
|
260
|
-
|
|
263
|
+
controller.moveOnlyOnscreenWithArrows(myHammer, controller.Speeds.Fast)
|
|
264
|
+
carnival.startCountdownGame(15, carnival.WinTypes.Score)
|
|
261
265
|
|
|
262
266
|
game.onUpdateInterval(1000, function () {
|
|
263
|
-
sprites.
|
|
267
|
+
sprites.moveToRandomHoleOnGrid(myMole)
|
|
264
268
|
})
|
|
265
269
|
|
|
266
270
|
```
|
|
267
271
|
|
|
268
272
|
|
|
269
|
-
|
|
270
273
|
```customts
|
|
271
274
|
|
|
272
|
-
|
|
273
|
-
//% block="win game"
|
|
274
|
-
Win,
|
|
275
|
-
//% block="lose game"
|
|
276
|
-
Lose,
|
|
277
|
-
//% block="high score"
|
|
278
|
-
Score,
|
|
279
|
-
//% block="multiplayer"
|
|
280
|
-
Multi
|
|
281
|
-
}
|
|
282
|
-
|
|
283
|
-
enum speeds {
|
|
284
|
-
//% block="fast"
|
|
285
|
-
Fast,
|
|
286
|
-
//% block="medium"
|
|
287
|
-
Med,
|
|
288
|
-
//% block="slow"
|
|
289
|
-
Slow
|
|
290
|
-
}
|
|
291
|
-
|
|
292
|
-
enum areas {
|
|
293
|
-
//% block="top"
|
|
294
|
-
Top,
|
|
295
|
-
//% block="middle"
|
|
296
|
-
Mid,
|
|
297
|
-
//% block="bottom"
|
|
298
|
-
Bottom
|
|
299
|
-
}
|
|
300
|
-
|
|
301
|
-
let textSprite: TextSprite = null
|
|
302
|
-
//let fanfare: effects.BackgroundEffect = undefined;
|
|
303
|
-
//let winStyle = winTypes.Score
|
|
304
|
-
|
|
305
|
-
|
|
275
|
+
namespace controller{
|
|
306
276
|
|
|
307
|
-
|
|
308
|
-
|
|
309
|
-
|
|
310
|
-
|
|
311
|
-
|
|
312
|
-
|
|
313
|
-
|
|
314
|
-
//% block="add label $myLabel to $myPosition of window || $myColor"
|
|
315
|
-
//% myLabel.defl="Whack-the-Mole"
|
|
316
|
-
//% myColor.shadow="colorindexpicker"
|
|
317
|
-
//% myColor.defl=4
|
|
318
|
-
//% myPosition.defl=areas.Bottom
|
|
319
|
-
//% inlineInputMode=inline
|
|
320
|
-
export function add_label_to(myLabel: string, myPosition: areas, myColor?:number) {
|
|
321
|
-
if (!myColor)
|
|
322
|
-
myColor = 4;
|
|
323
|
-
|
|
324
|
-
textSprite = textsprite.create(myLabel, 0, myColor)
|
|
325
|
-
if (myPosition == areas.Bottom) textSprite.setPosition(80, 110);
|
|
326
|
-
if (myPosition == areas.Mid) textSprite.setPosition(80, 50);
|
|
327
|
-
if (myPosition == areas.Top) textSprite.setPosition(80, 20);
|
|
277
|
+
export enum Speeds {
|
|
278
|
+
//% block="fast"
|
|
279
|
+
Fast,
|
|
280
|
+
//% block="medium"
|
|
281
|
+
Med,
|
|
282
|
+
//% block="slow"
|
|
283
|
+
Slow
|
|
328
284
|
}
|
|
329
|
-
}
|
|
330
285
|
|
|
331
|
-
namespace controller{
|
|
332
286
|
|
|
333
287
|
/**
|
|
334
288
|
* Combines a simple "move with arrows"
|
|
@@ -337,13 +291,13 @@ namespace controller{
|
|
|
337
291
|
//% color="#d54322"
|
|
338
292
|
//% blockId=move_only_onscreen_with_arrows
|
|
339
293
|
//% block="move $thisSprite=variables_get(myHammer) on screen with speed $mySpeed"
|
|
340
|
-
//% mySpeed.defl=
|
|
294
|
+
//% mySpeed.defl=Speeds.Fast
|
|
341
295
|
//% inlineInputMode=inline
|
|
342
|
-
export function
|
|
296
|
+
export function moveOnlyOnscreenWithArrows(thisSprite: Sprite, mySpeed: Speeds) {
|
|
343
297
|
thisSprite.setStayInScreen(true)
|
|
344
|
-
if (mySpeed ==
|
|
298
|
+
if (mySpeed == Speeds.Fast) {
|
|
345
299
|
controller.moveSprite(thisSprite, 225, 225)
|
|
346
|
-
} else if (mySpeed ==
|
|
300
|
+
} else if (mySpeed == Speeds.Med) {
|
|
347
301
|
controller.moveSprite(thisSprite, 175, 175)
|
|
348
302
|
} else {
|
|
349
303
|
controller.moveSprite(thisSprite, 100, 100)
|
|
@@ -361,251 +315,17 @@ namespace sprites {
|
|
|
361
315
|
//% blockId=move_to_random_hole_on_grid
|
|
362
316
|
//% block="move sprite $thisSprite=variables_get(myMole) to random area"
|
|
363
317
|
//% inlineInputMode=inline
|
|
364
|
-
export function
|
|
318
|
+
export function moveToRandomHoleOnGrid(thisSprite: Sprite) {
|
|
365
319
|
thisSprite.setPosition(simplified.chooseRandomNumber(28, 80, 130), simplified.chooseRandomNumber(21, 53, 85))
|
|
320
|
+
simplified.still = 0;
|
|
366
321
|
}
|
|
367
322
|
}
|
|
368
323
|
|
|
369
|
-
namespace info {
|
|
370
|
-
let countdownInitialized = false;
|
|
371
|
-
/**
|
|
372
|
-
* Adds game end style to countdown
|
|
373
|
-
*/
|
|
374
|
-
//% color="#cf6a87"
|
|
375
|
-
//% group=countdown
|
|
376
|
-
//% blockId=start_countdown_game
|
|
377
|
-
//% block="start countdown $myTime (s) || and game over $winType effect $winEffect"
|
|
378
|
-
//% myTime.defl=15
|
|
379
|
-
//% winType.defl=winTypes.Score
|
|
380
|
-
//% winEffect.defl=effects.confetti
|
|
381
|
-
//% inlineInputMode=inline
|
|
382
|
-
export function startCountdownGame(myTime: number, winType?: winTypes, winEffect?: effects.BackgroundEffect) {
|
|
383
|
-
if (!winType)
|
|
384
|
-
winType = winTypes.Win;
|
|
385
|
-
if (!winEffect && winType != winTypes.Lose){
|
|
386
|
-
winEffect = effects.confetti;
|
|
387
|
-
}
|
|
388
|
-
else { winEffect = effects.melt;}
|
|
389
|
-
init(winType, winEffect);
|
|
390
|
-
info.startCountdown(myTime)
|
|
391
|
-
|
|
392
|
-
}
|
|
393
|
-
|
|
394
|
-
export function newGameOver(winStyle: winTypes, fanfare: effects.BackgroundEffect) {
|
|
395
|
-
|
|
396
|
-
// Prep default variables for different win types
|
|
397
|
-
let winnerNumber = 1;
|
|
398
|
-
let thisHigh = 0;
|
|
399
|
-
|
|
400
|
-
// Save all scores as relevant to the game.
|
|
401
|
-
info.saveAllScores();
|
|
402
|
-
|
|
403
|
-
// collect the scores before popping the scenes
|
|
404
|
-
const scoreInfo1 = info.player1.getState();
|
|
405
|
-
const scoreInfo2 = info.player2.getState();
|
|
406
|
-
const scoreInfo3 = info.player3.getState();
|
|
407
|
-
const scoreInfo4 = info.player4.getState();
|
|
408
|
-
const highScore = info.highScore();
|
|
409
|
-
const allScores = [scoreInfo1.score, scoreInfo2.score, scoreInfo3.score, scoreInfo4.score];
|
|
410
|
-
|
|
411
|
-
// Find player with highest score
|
|
412
|
-
for (let i = 0; i < 4; i++) {
|
|
413
|
-
if (allScores[i] > thisHigh) {
|
|
414
|
-
thisHigh = allScores[i];
|
|
415
|
-
winnerNumber = i+1;
|
|
416
|
-
}
|
|
417
|
-
}
|
|
418
|
-
// If highest score is higher than saved high, replace
|
|
419
|
-
if (thisHigh > highScore){
|
|
420
|
-
info.saveHighScore(); }
|
|
421
|
-
|
|
422
|
-
|
|
423
|
-
// releasing memory and clear fibers. Do not add anything that releases the fiber until background is set below,
|
|
424
|
-
// or screen will be cleared on the new frame and will not appear as background in the game over screen.
|
|
425
|
-
game.popScene();
|
|
426
|
-
game.pushScene();
|
|
427
|
-
scene.setBackgroundImage(screen.clone());
|
|
428
|
-
|
|
429
|
-
music.powerUp.play();
|
|
430
|
-
|
|
431
|
-
fanfare.startScreenEffect();
|
|
432
|
-
|
|
433
|
-
pause(400);
|
|
434
324
|
|
|
435
|
-
|
|
436
|
-
scene.createRenderable(scene.HUD_Z, target => {
|
|
437
|
-
overDialog.update();
|
|
438
|
-
target.drawTransparentImage(
|
|
439
|
-
overDialog.image,
|
|
440
|
-
0,
|
|
441
|
-
(screen.height - overDialog.image.height) >> 1
|
|
442
|
-
);
|
|
443
|
-
});
|
|
444
|
-
pause(500); // wait for users to stop pressing keys
|
|
445
|
-
overDialog.displayCursor();
|
|
446
|
-
game.waitAnyButton();
|
|
447
|
-
control.reset();
|
|
448
|
-
|
|
449
|
-
}
|
|
450
|
-
|
|
451
|
-
function init(winStyle: winTypes, fanfare: effects.BackgroundEffect) {
|
|
452
|
-
if (countdownInitialized) return;
|
|
453
|
-
countdownInitialized = true;
|
|
454
|
-
|
|
455
|
-
info.onCountdownEnd(function () {
|
|
456
|
-
if (winStyle == winTypes.Win) {
|
|
457
|
-
game.over(true, fanfare)
|
|
458
|
-
} else if (winStyle == winTypes.Lose) {
|
|
459
|
-
game.over(false, fanfare)
|
|
460
|
-
} else {
|
|
461
|
-
newGameOver(winStyle, fanfare);
|
|
462
|
-
}
|
|
463
|
-
})
|
|
464
|
-
}
|
|
465
|
-
|
|
466
|
-
export class GameOverDialog extends game.BaseDialog {
|
|
467
|
-
protected cursorOn: boolean;
|
|
468
|
-
protected isNewHighScore: boolean;
|
|
469
|
-
|
|
470
|
-
constructor(
|
|
471
|
-
protected win: boolean,
|
|
472
|
-
protected score?: number,
|
|
473
|
-
protected highScore?: number,
|
|
474
|
-
protected winnerNum?: number,
|
|
475
|
-
protected winStyle?: winTypes
|
|
476
|
-
) {
|
|
477
|
-
super(screen.width, 46, img`
|
|
478
|
-
1 1 1
|
|
479
|
-
f f f
|
|
480
|
-
1 1 1
|
|
481
|
-
`);
|
|
482
|
-
this.cursorOn = false;
|
|
483
|
-
this.isNewHighScore = this.score > this.highScore;
|
|
484
|
-
}
|
|
485
|
-
|
|
486
|
-
displayCursor() {
|
|
487
|
-
this.cursorOn = true;
|
|
488
|
-
}
|
|
489
|
-
|
|
490
|
-
update() {
|
|
491
|
-
this.clearInterior();
|
|
492
|
-
this.drawTextCore();
|
|
493
|
-
|
|
494
|
-
if (this.cursorOn) {
|
|
495
|
-
this.drawCursorRow();
|
|
496
|
-
}
|
|
497
|
-
}
|
|
498
|
-
|
|
499
|
-
drawTextCore() {
|
|
500
|
-
const titleHeight = 8;
|
|
501
|
-
if (this.winStyle == winTypes.Multi){
|
|
502
|
-
this.image.printCenter(
|
|
503
|
-
"Player " + this.winnerNum + " wins!",
|
|
504
|
-
titleHeight,
|
|
505
|
-
screen.isMono ? 1 : 5,
|
|
506
|
-
image.font8
|
|
507
|
-
);
|
|
508
|
-
|
|
509
|
-
if (this.score !== undefined) {
|
|
510
|
-
const scoreHeight = 23;
|
|
511
|
-
const highScoreHeight = 34;
|
|
512
|
-
const scoreColor = screen.isMono ? 1 : 2;
|
|
513
|
-
|
|
514
|
-
this.image.printCenter(
|
|
515
|
-
"Score:" + this.score,
|
|
516
|
-
scoreHeight,
|
|
517
|
-
scoreColor,
|
|
518
|
-
image.font8
|
|
519
|
-
);
|
|
520
|
-
|
|
521
|
-
if (this.isNewHighScore) {
|
|
522
|
-
this.image.printCenter(
|
|
523
|
-
"New High Score!",
|
|
524
|
-
highScoreHeight,
|
|
525
|
-
scoreColor,
|
|
526
|
-
image.font5
|
|
527
|
-
);
|
|
528
|
-
} else {
|
|
529
|
-
this.image.printCenter(
|
|
530
|
-
"HI:" + this.highScore,
|
|
531
|
-
highScoreHeight,
|
|
532
|
-
scoreColor,
|
|
533
|
-
image.font8
|
|
534
|
-
);
|
|
535
|
-
}
|
|
536
|
-
}
|
|
537
|
-
}
|
|
538
|
-
else {
|
|
539
|
-
this.image.printCenter(
|
|
540
|
-
"Great Job!",
|
|
541
|
-
titleHeight,
|
|
542
|
-
screen.isMono ? 1 : 5,
|
|
543
|
-
image.font8
|
|
544
|
-
);
|
|
545
|
-
|
|
546
|
-
if (this.score !== undefined) {
|
|
547
|
-
const scoreHeight = 23;
|
|
548
|
-
const highScoreHeight = 34;
|
|
549
|
-
const scoreColor = screen.isMono ? 1 : 2;
|
|
550
|
-
|
|
551
|
-
this.image.printCenter(
|
|
552
|
-
"Score:" + this.score,
|
|
553
|
-
scoreHeight,
|
|
554
|
-
scoreColor,
|
|
555
|
-
image.font8
|
|
556
|
-
);
|
|
557
|
-
|
|
558
|
-
if (this.isNewHighScore) {
|
|
559
|
-
this.image.printCenter(
|
|
560
|
-
"New High Score!",
|
|
561
|
-
highScoreHeight,
|
|
562
|
-
scoreColor,
|
|
563
|
-
image.font5
|
|
564
|
-
);
|
|
565
|
-
} else {
|
|
566
|
-
this.image.printCenter(
|
|
567
|
-
"HI:" + this.highScore,
|
|
568
|
-
highScoreHeight,
|
|
569
|
-
scoreColor,
|
|
570
|
-
image.font8
|
|
571
|
-
);
|
|
572
|
-
}
|
|
573
|
-
}
|
|
574
|
-
}
|
|
575
|
-
}
|
|
576
|
-
}
|
|
577
|
-
}
|
|
325
|
+
namespace simplified {
|
|
578
326
|
|
|
579
|
-
|
|
580
|
-
/**
|
|
581
|
-
* Adds additional end game styles
|
|
582
|
-
*/
|
|
583
|
-
//% color="#8854d0"
|
|
584
|
-
//% group=Gameplay
|
|
585
|
-
//% blockId=on_game_over_expanded
|
|
586
|
-
//% block="game over $winStyle || add effect $winEffect"
|
|
587
|
-
//% winType.defl=winTypes.Win
|
|
588
|
-
//% winEffect.defl=effects.confetti
|
|
589
|
-
//% inlineInputMode=inline
|
|
590
|
-
export function onGameOverExpanded(winStyle: winTypes, winEffect?: effects.BackgroundEffect) {
|
|
591
|
-
if (!winStyle)
|
|
592
|
-
winStyle = winTypes.Win;
|
|
593
|
-
if (!winEffect && winStyle != winTypes.Lose) {
|
|
594
|
-
winEffect = effects.confetti;
|
|
595
|
-
}
|
|
596
|
-
else { winEffect = effects.melt; }
|
|
327
|
+
export let still = 0;
|
|
597
328
|
|
|
598
|
-
if (winStyle == winTypes.Win) {
|
|
599
|
-
game.over(true, winEffect)
|
|
600
|
-
} else if (winStyle == winTypes.Lose) {
|
|
601
|
-
game.over(false, winEffect)
|
|
602
|
-
} else {
|
|
603
|
-
info.newGameOver(winStyle, winEffect);
|
|
604
|
-
}
|
|
605
|
-
}
|
|
606
|
-
}
|
|
607
|
-
|
|
608
|
-
namespace simplified {
|
|
609
329
|
/**
|
|
610
330
|
* Randomly chooses one of the parameter numbers
|
|
611
331
|
*
|
|
@@ -632,7 +352,18 @@ namespace simplified {
|
|
|
632
352
|
return myList._pickRandom();
|
|
633
353
|
}
|
|
634
354
|
|
|
355
|
+
/**
|
|
356
|
+
* Checks to see if mole has been moved since last time position was checked
|
|
357
|
+
*/
|
|
635
358
|
|
|
359
|
+
//% blockId=check_mole_escape
|
|
360
|
+
//% block="check if mole has escaped"
|
|
361
|
+
export function checkMoleEscape () {
|
|
362
|
+
if (still == 1) {
|
|
363
|
+
info.player2.changeScoreBy(1)
|
|
364
|
+
}
|
|
365
|
+
still = 1
|
|
366
|
+
}
|
|
636
367
|
|
|
637
368
|
}
|
|
638
369
|
|
|
File without changes
|
package/docs/skillmap/mole.md
CHANGED
|
@@ -3,7 +3,7 @@
|
|
|
3
3
|
* description: Create your own mole whacking carnival game. Double-click the first level to start.
|
|
4
4
|
* infoUrl: skillmap/educator-info/mole-map-info
|
|
5
5
|
* bannerUrl: /static/skillmap/mole/mole3.gif
|
|
6
|
-
* backgroundurl:
|
|
6
|
+
* backgroundurl: /static/skillmap/backgrounds/mole-comp.gif
|
|
7
7
|
* primarycolor: #ffffff
|
|
8
8
|
* secondarycolor: #fff53d
|
|
9
9
|
* tertiarycolor: #82cd54
|
|
@@ -47,13 +47,23 @@
|
|
|
47
47
|
* type: tutorial
|
|
48
48
|
* description: Finish your game by adding a thrilling carnival sound and real frame-by-frame animations!
|
|
49
49
|
* tags: easy, clicker, sprite, buttons
|
|
50
|
-
* next:
|
|
50
|
+
* next: mole4
|
|
51
51
|
* url: /skillmap/mole/mole3
|
|
52
52
|
* imageUrl: /static/skillmap/mole/mole3.gif
|
|
53
53
|
* position: 1 1
|
|
54
54
|
|
|
55
55
|
|
|
56
56
|
|
|
57
|
+
### mole4
|
|
58
|
+
* name: Play with Friends
|
|
59
|
+
* type: tutorial
|
|
60
|
+
* description: Want to play with friends? A few simple changes will have you playing chase in no time!
|
|
61
|
+
* tags: easy, clicker, multiplayer, buttons
|
|
62
|
+
* next: mole-cert
|
|
63
|
+
* url: /skillmap/mole/mole4
|
|
64
|
+
* imageUrl: /static/skillmap/mole/mole3.gif
|
|
65
|
+
* position: 1 0
|
|
66
|
+
|
|
57
67
|
|
|
58
68
|
### mole-cert
|
|
59
69
|
* name: Congrats!
|
|
@@ -61,9 +71,10 @@
|
|
|
61
71
|
* type: certificate
|
|
62
72
|
* url: /static/skillmap/certificates/mole-cert.pdf
|
|
63
73
|
* imageUrl: /static/skillmap/certificates/mole-cert.png
|
|
74
|
+
* showMultiplayerShare: true
|
|
64
75
|
* position: 2 0
|
|
65
76
|
* actions:
|
|
66
|
-
* map: [
|
|
77
|
+
* map: [Try Burstin' Balloons](/skillmap/balloon)
|
|
67
78
|
* editor: [Open in Creative Mode](/)
|
|
68
79
|
* rewards:
|
|
69
80
|
* certificate:
|
|
@@ -72,4 +83,3 @@
|
|
|
72
83
|
* completion-badge:
|
|
73
84
|
* image: /static/badges/badge-mole.png
|
|
74
85
|
* name: Whack-the-Mole
|
|
75
|
-
|