pxt-arcade 1.11.21 → 1.11.22

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.
Files changed (35) hide show
  1. package/built/common-sim.d.ts +5 -0
  2. package/built/common-sim.js +28 -4
  3. package/built/sim.js +35 -6
  4. package/built/target.js +628 -315
  5. package/built/target.json +628 -315
  6. package/built/targetlight.json +5 -5
  7. package/docs/static/skillmap/assets/gallery.png +0 -0
  8. package/docs/static/skillmap/backgrounds/dino-comp.png +0 -0
  9. package/docs/static/skillmap/backgrounds/story-comp.png +0 -0
  10. package/docs/test/skillmap/balloon/balloon4.md +73 -50
  11. package/docs/test/skillmap/dino/collectort1.md +334 -0
  12. package/docs/test/skillmap/dino/collectort2.md +272 -0
  13. package/docs/test/skillmap/dino/collectort3.md +304 -0
  14. package/docs/test/skillmap/dino/collectort4.md +330 -0
  15. package/docs/test/skillmap/dino/collectort4old.md +433 -0
  16. package/docs/test/skillmap/dino/collectort5.md +499 -0
  17. package/docs/test/skillmap/dino/scroller.ts +54 -0
  18. package/docs/test/skillmap/mole/mole1.md +3 -3
  19. package/docs/test/skillmap/mole/mole2.md +8 -8
  20. package/docs/test/skillmap/mole/mole3.md +12 -12
  21. package/docs/test/skillmap/mole/mole4.md +5 -5
  22. package/docs/test/skillmap/star/star1.md +270 -0
  23. package/docs/test/skillmap/star/star2.md +262 -0
  24. package/docs/test/skillmap/star/star3.md +186 -0
  25. package/docs/test/skillmap/star/star4.md +162 -0
  26. package/docs/test/skillmap/star.md +86 -0
  27. package/docs/test/skillmap/story/joke-examples.md +41 -0
  28. package/docs/test/skillmap/story/story1.md +275 -0
  29. package/docs/test/skillmap/story/story2.md +289 -0
  30. package/docs/test/skillmap/story/story3.md +626 -0
  31. package/docs/test/skillmap/story/story4.md +1774 -0
  32. package/docs/test/skillmap/story.md +90 -0
  33. package/docs/test/tutorials/wakanda.md +417 -0
  34. package/package.json +4 -4
  35. package/targetconfig.json +2 -1
@@ -0,0 +1,433 @@
1
+ # Give it Life
2
+
3
+ ### @autoexpandOff true
4
+
5
+
6
+ ```template
7
+ info.onCountdownEnd(function () {
8
+ game.over(true)
9
+ })
10
+ sprites.onOverlap(SpriteKind.Player, SpriteKind.Projectile, function (sprite, otherSprite) {
11
+ otherSprite.destroy(effects.rings, 200)
12
+ info.changeScoreBy(1)
13
+ })
14
+ sprites.onOverlap(SpriteKind.Player, SpriteKind.Enemy, function (sprite, otherSprite) {
15
+ otherSprite.destroy(effects.fire, 200)
16
+ info.changeLifeBy(-1)
17
+ })
18
+ let myEnemy: Sprite = null
19
+ let projectile: Sprite = null
20
+ scene.setBackgroundColor(3)
21
+ let mySprite = sprites.create(img`
22
+ . . . . . . . . . b 5 b . . . .
23
+ . . . . . . . . . b 5 b . . . .
24
+ . . . . . . b b b b b b . . . .
25
+ . . . . . b b 5 5 5 5 5 b . . .
26
+ . . . . b b 5 b c 5 5 d 4 c . .
27
+ . b b b b 5 5 5 b f d d 4 4 4 b
28
+ . b d 5 b 5 5 b c b 4 4 4 4 b .
29
+ . . b 5 5 b 5 5 5 4 4 4 4 b . .
30
+ . . b d 5 5 b 5 5 5 5 5 5 b . .
31
+ . b d b 5 5 5 d 5 5 5 5 5 5 b .
32
+ b d d c d 5 5 b 5 5 5 5 5 5 b .
33
+ c d d d c c b 5 5 5 5 5 5 5 b .
34
+ c b d d d d d 5 5 5 5 5 5 5 b .
35
+ . c d d d d d d 5 5 5 5 5 d b .
36
+ . . c b d d d d d 5 5 5 b b . .
37
+ . . . c c c c c c c c b b . . .
38
+ `, SpriteKind.Player)
39
+ controller.moveSprite(mySprite, 0, 100)
40
+ mySprite.setStayInScreen(true)
41
+ info.startCountdown(15)
42
+ forever(function () {
43
+ projectile = sprites.createProjectileFromSide(img`
44
+ . . b b b b . .
45
+ . b 5 5 5 5 b .
46
+ b 5 d 3 3 d 5 b
47
+ b 5 3 5 5 1 5 b
48
+ c 5 3 5 5 1 d c
49
+ c d d 1 1 d d c
50
+ . f d d d d f .
51
+ . . f f f f . .
52
+ `, -90, 0)
53
+ projectile.y = randint(0, 120)
54
+ pause(randint(1000, 2000))
55
+ })
56
+ forever(function () {
57
+ myEnemy = sprites.createProjectileFromSide(img`
58
+ . . . . . . . . . . . . . . . .
59
+ . . . . . . . . . . . . . . . .
60
+ . . . . . . . . . . . . . . . .
61
+ . . . . . . . . . . . . . . . .
62
+ . . . . . . . . . . . . . . . .
63
+ . . . . . . . c c c . . . . . .
64
+ . . . . . . a b a a . . . . . .
65
+ . . . . . c b a f c a c . . . .
66
+ . . . . c b b b f f a c c . . .
67
+ . . . . b b f a b b a a c . . .
68
+ . . . . c b f f b a f c a . . .
69
+ . . . . . c a a c b b a . . . .
70
+ . . . . . . c c c c . . . . . .
71
+ . . . . . . . c . . . . . . . .
72
+ . . . . . . . . . . . . . . . .
73
+ . . . . . . . . . . . . . . . .
74
+ `, -90, 0)
75
+ myEnemy.setKind(SpriteKind.Enemy)
76
+ myEnemy.y = randint(0, 120)
77
+ pause(randint(1200, 2200))
78
+ })
79
+
80
+ ```
81
+
82
+
83
+ ```ghost
84
+
85
+ info.onCountdownEnd(function () {
86
+ game.over(true)
87
+ })
88
+ sprites.onOverlap(SpriteKind.Player, SpriteKind.Projectile, function (sprite, otherSprite) {
89
+ otherSprite.destroy(effects.rings, 200)
90
+ info.changeScoreBy(1)
91
+ })
92
+ sprites.onOverlap(SpriteKind.Player, SpriteKind.Food, function (sprite, otherSprite) {
93
+ otherSprite.destroy(effects.hearts, 200)
94
+ info.changeLifeBy(1)
95
+ })
96
+ sprites.onOverlap(SpriteKind.Player, SpriteKind.Enemy, function (sprite, otherSprite) {
97
+ otherSprite.destroy(effects.fire, 200)
98
+ info.changeLifeBy(-1)
99
+ })
100
+ let extraLife: Sprite = null
101
+ let myEnemy: Sprite = null
102
+ let projectile: Sprite = null
103
+ scene.setBackgroundColor(3)
104
+ let mySprite = sprites.create(img`
105
+ . . . . . . . . . b 5 b . . . .
106
+ . . . . . . . . . b 5 b . . . .
107
+ . . . . . . b b b b b b . . . .
108
+ . . . . . b b 5 5 5 5 5 b . . .
109
+ . . . . b b 5 b c 5 5 d 4 c . .
110
+ . b b b b 5 5 5 b f d d 4 4 4 b
111
+ . b d 5 b 5 5 b c b 4 4 4 4 b .
112
+ . . b 5 5 b 5 5 5 4 4 4 4 b . .
113
+ . . b d 5 5 b 5 5 5 5 5 5 b . .
114
+ . b d b 5 5 5 d 5 5 5 5 5 5 b .
115
+ b d d c d 5 5 b 5 5 5 5 5 5 b .
116
+ c d d d c c b 5 5 5 5 5 5 5 b .
117
+ c b d d d d d 5 5 5 5 5 5 5 b .
118
+ . c d d d d d d 5 5 5 5 5 d b .
119
+ . . c b d d d d d 5 5 5 b b . .
120
+ . . . c c c c c c c c b b . . .
121
+ `, SpriteKind.Player)
122
+ controller.moveSprite(mySprite, 0, 100)
123
+ mySprite.setStayInScreen(true)
124
+ info.startCountdown(15)
125
+ forever(function () {
126
+ projectile = sprites.createProjectileFromSide(img`
127
+ . . b b b b . .
128
+ . b 5 5 5 5 b .
129
+ b 5 d 3 3 d 5 b
130
+ b 5 3 5 5 1 5 b
131
+ c 5 3 5 5 1 d c
132
+ c d d 1 1 d d c
133
+ . f d d d d f .
134
+ . . f f f f . .
135
+ `, -90, 0)
136
+ projectile.y = randint(0, 120)
137
+ pause(randint(1000, 2000))
138
+ })
139
+ forever(function () {
140
+ myEnemy = sprites.createProjectileFromSide(img`
141
+ . . . . . . . . . . . . . . . .
142
+ . . . . . . . . . . . . . . . .
143
+ . . . . . . . . . . . . . . . .
144
+ . . . . . . . . . . . . . . . .
145
+ . . . . . . . . . . . . . . . .
146
+ . . . . . . . c c c . . . . . .
147
+ . . . . . . a b a a . . . . . .
148
+ . . . . . c b a f c a c . . . .
149
+ . . . . c b b b f f a c c . . .
150
+ . . . . b b f a b b a a c . . .
151
+ . . . . c b f f b a f c a . . .
152
+ . . . . . c a a c b b a . . . .
153
+ . . . . . . c c c c . . . . . .
154
+ . . . . . . . c . . . . . . . .
155
+ . . . . . . . . . . . . . . . .
156
+ . . . . . . . . . . . . . . . .
157
+ `, -90, 0)
158
+ myEnemy.y = randint(0, 120)
159
+ myEnemy.setKind(SpriteKind.Enemy)
160
+ pause(randint(1200, 2200))
161
+
162
+ })
163
+ forever(function () {
164
+ extraLife = sprites.createProjectileFromSide(img`
165
+ . . . . . . . . . . . . . . . .
166
+ . . . . . . . . . . . . . . . .
167
+ . . . . . . . . . . . . . . . .
168
+ . . c c c . . . . . c c c . . .
169
+ . c 2 2 2 c c . c c 2 2 2 c . .
170
+ . c 2 2 2 2 2 c 2 2 2 2 2 c . .
171
+ . c 2 2 2 2 2 2 2 2 2 2 2 c . .
172
+ . c 2 2 2 2 2 2 2 2 2 2 2 c . .
173
+ . c 2 2 2 2 2 2 2 2 2 2 2 c . .
174
+ . . c 2 2 2 2 2 2 2 2 2 c . . .
175
+ . . . c 2 2 2 2 2 2 2 c . . . .
176
+ . . . . c c 2 2 2 c c . . . . .
177
+ . . . . . . c 2 c . . . . . . .
178
+ . . . . . . . c . . . . . . . .
179
+ . . . . . . . . . . . . . . . .
180
+ . . . . . . . . . . . . . . . .
181
+ `, -90, 0)
182
+ extraLife.y = randint(0, 120)
183
+ extraLife.setKind(SpriteKind.Food)
184
+ pause(randint(4000, 5000))
185
+ otherSprite.say("+1", 1000)
186
+
187
+ })
188
+
189
+
190
+ ```
191
+
192
+
193
+
194
+ ## {Intro @showdialog}
195
+
196
+ Ready to give your game some extra life?
197
+
198
+
199
+ ![Collect extra lives](/static/skillmap/collector/collector-activity-4.gif "Collect your jar of hearts" )
200
+
201
+
202
+
203
+ ## {Step 1}
204
+
205
+ The code for a collector game is already in the workspace.
206
+
207
+ **❤️ Let's add the ability to collect extra lives ❤️**
208
+
209
+ ---
210
+
211
+ - :mouse pointer: Right-click on the ``||loops:forever||`` loop container that holds
212
+ the code to create **myEnemy** and choose **Duplicate** from the
213
+ top of the menu.
214
+
215
+ - :mouse pointer: Inside that new loop, click on the ``||variables: myEnemy||`` variable in the
216
+ **set projectile to** block. A dropdown will appear, allowing you to
217
+ select **New variable...** .
218
+
219
+ - :mouse pointer: Name your extra life projectile **extraLife**.
220
+
221
+
222
+ ```blocks
223
+ forever(function () {
224
+ let myEnemy: Sprite = null
225
+ //@highlight
226
+ let extraLife = sprites.createProjectileFromSide(img`
227
+ . . . . . . . . . . . . . . . .
228
+ . . . . . . . . . . . . . . . .
229
+ . . . . . . . . . . . . . . . .
230
+ . . . . . . . . . . . . . . . .
231
+ . . . . . . . . . . . . . . . .
232
+ . . . . . . . c c c . . . . . .
233
+ . . . . . . a b a a . . . . . .
234
+ . . . . . c b a f c a c . . . .
235
+ . . . . c b b b f f a c c . . .
236
+ . . . . b b f a b b a a c . . .
237
+ . . . . c b f f b a f c a . . .
238
+ . . . . . c a a c b b a . . . .
239
+ . . . . . . c c c c . . . . . .
240
+ . . . . . . . c . . . . . . . .
241
+ . . . . . . . . . . . . . . . .
242
+ . . . . . . . . . . . . . . . .
243
+ `, -90, 0)
244
+ myEnemy.y = randint(0, 120)
245
+ myEnemy.setKind(SpriteKind.Enemy)
246
+ pause(randint(1500, 2500))
247
+ })
248
+
249
+ ```
250
+
251
+
252
+ ## {Step 2}
253
+
254
+ **The extra life isn't quite ready.**
255
+
256
+ Let's make sure to get all the blocks
257
+ in the new **forever** loop pointed to the right place.
258
+
259
+ ---
260
+
261
+ - :mouse pointer: Change the variables in both the **set y to** block AND the **set kind to**
262
+ block from ``||variables:myEnemy||`` to ``||variables:extraLife||``.
263
+
264
+ - :mouse pointer: Now change the image for the **extraLife** sprite from a rock to
265
+ something healing...like a heart or a potion.
266
+
267
+ - :mouse pointer: Extra lives aren't the enemy, they're fuel! In the **set kind to** block,
268
+ change **Enemy** to **Food**.
269
+
270
+
271
+ ```blocks
272
+
273
+ forever(function () {
274
+ let extraLife = sprites.createProjectileFromSide(img`
275
+ . . . . . . . . . . . . . . . .
276
+ . . . . . . . . . . . . . . . .
277
+ . . . . . . . . . . . . . . . .
278
+ . . c c c . . . . . c c c . . .
279
+ . c 2 2 2 c c . c c 2 2 2 c . .
280
+ . c 2 2 2 2 2 c 2 2 2 2 2 c . .
281
+ . c 2 2 2 2 2 2 2 2 2 2 2 c . .
282
+ . c 2 2 2 2 2 2 2 2 2 2 2 c . .
283
+ . c 2 2 2 2 2 2 2 2 2 2 2 c . .
284
+ . . c 2 2 2 2 2 2 2 2 2 c . . .
285
+ . . . c 2 2 2 2 2 2 2 c . . . .
286
+ . . . . c c 2 2 2 c c . . . . .
287
+ . . . . . . c 2 c . . . . . . .
288
+ . . . . . . . c . . . . . . . .
289
+ . . . . . . . . . . . . . . . .
290
+ . . . . . . . . . . . . . . . .
291
+ `, -90, 0)
292
+ extraLife.y = randint(0, 120)
293
+ extraLife.setKind(SpriteKind.Food)
294
+ pause(randint(1200, 2200))
295
+ })
296
+
297
+ ```
298
+
299
+
300
+ ## {Step 3}
301
+
302
+ Extra lives are supposed to be special, but they appear just as much
303
+ as the other two projectiles right now.
304
+
305
+ **Let's set a longer random pause for extraLife.**
306
+
307
+ ---
308
+
309
+ - :mouse pointer: Inside the new **extraLife** forever loop, change the
310
+ random **pause** to stay between **4500** and **5500** ms.
311
+
312
+
313
+ ```blocks
314
+
315
+ forever(function () {
316
+ let extraLife = sprites.createProjectileFromSide(img`
317
+ . . . . . . . . . . . . . . . .
318
+ . . . . . . . . . . . . . . . .
319
+ . . . . . . . . . . . . . . . .
320
+ . . c c c . . . . . c c c . . .
321
+ . c 2 2 2 c c . c c 2 2 2 c . .
322
+ . c 2 2 2 2 2 c 2 2 2 2 2 c . .
323
+ . c 2 2 2 2 2 2 2 2 2 2 2 c . .
324
+ . c 2 2 2 2 2 2 2 2 2 2 2 c . .
325
+ . c 2 2 2 2 2 2 2 2 2 2 2 c . .
326
+ . . c 2 2 2 2 2 2 2 2 2 c . . .
327
+ . . . c 2 2 2 2 2 2 2 c . . . .
328
+ . . . . c c 2 2 2 c c . . . . .
329
+ . . . . . . c 2 c . . . . . . .
330
+ . . . . . . . c . . . . . . . .
331
+ . . . . . . . . . . . . . . . .
332
+ . . . . . . . . . . . . . . . .
333
+ `, -90, 0)
334
+ extraLife.y = randint(0, 120)
335
+ extraLife.setKind(SpriteKind.Enemy)
336
+ //@highlight
337
+ pause(randint(4500, 5500))
338
+ })
339
+
340
+ ```
341
+
342
+
343
+
344
+ ## {Step 4}
345
+
346
+ **Play through your game once or twice. Notice anything wrong?**
347
+
348
+ That's right! Nothing happens when you collect an extra life. Let's
349
+ fix that.
350
+
351
+ ---
352
+
353
+ - :mouse pointer: Duplicate the **on sprite overlaps Enemy** container that's already in the
354
+ workspace.
355
+
356
+ - :mouse pointer: In the header of the new container,
357
+ change the second **kind** from **Enemy** to **Food**.
358
+
359
+ - :mouse pointer: Change the effect from **fire** to something more appropriate for an
360
+ extra life. (**Hearts** work well with this theme.)
361
+
362
+
363
+
364
+ ```blocks
365
+ sprites.onOverlap(SpriteKind.Player, SpriteKind.Food, function (sprite, otherSprite) {
366
+ otherSprite.destroy(effects.hearts, 200)
367
+ info.changeLifeBy(1)
368
+ })
369
+ ```
370
+
371
+
372
+ ## {Step 6}
373
+
374
+ The extra life is still **subtracting** a life when collected.
375
+
376
+ Let's make it **add** one, instead.
377
+
378
+ ---
379
+
380
+ - :mouse pointer: Inside the **on sprite overlaps Food** container,
381
+ Look for the ``||info:change life by [-1]||`` block
382
+ and change **-1** to **1**.
383
+
384
+ - :mouse pointer: To exaggerate this gift even more, open the ``||sprites:Sprites||`` category
385
+ and grab a ``||sprites:[mySprite] say [":)"]||`` block.
386
+
387
+ - :mouse pointer: Snap the new block into the **top** of the **on sprite overlaps Food** container.
388
+
389
+
390
+
391
+ ```blocks
392
+ let mySprite: Sprite = null
393
+
394
+ sprites.onOverlap(SpriteKind.Player, SpriteKind.Food, function (sprite, otherSprite) {
395
+ mySprite.say(":)")
396
+ otherSprite.destroy(effects.hearts, 200)
397
+ info.changeLifeBy(1)
398
+ })
399
+
400
+ ```
401
+
402
+
403
+
404
+ ## {Step 7}
405
+
406
+ - :mouse pointer: The new **mySprite say** block is pointed toward the wrong sprite. To fix that,
407
+ drag the ``||variables:otherSprite||`` argument out of the header of the
408
+ **on sprite overlaps Food** header and snap it in to replace the
409
+ ``||variables:mySprite||`` variable.
410
+
411
+ - :mouse pointer: Change the text from **:)** to **+1**.
412
+
413
+
414
+ ```blocks
415
+
416
+ sprites.onOverlap(SpriteKind.Player, SpriteKind.Food, function (sprite, otherSprite) {
417
+ //@highlight
418
+ otherSprite.say("+1")
419
+ otherSprite.destroy(effects.hearts, 200)
420
+ info.changeLifeBy(1)
421
+ })
422
+
423
+ ```
424
+
425
+ ## {Step 8}
426
+
427
+
428
+ **There you go!**
429
+
430
+ You have a full-featured game that anyone would be proud of.
431
+
432
+ Click **Done** to return to the main page where you can share your game
433
+ with family and friends!