pxt-arcade 1.7.2 → 1.7.6

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 (235) hide show
  1. package/built/common-sim.d.ts +2 -0
  2. package/built/common-sim.js +4 -0
  3. package/built/target.js +1795 -242
  4. package/built/target.json +1795 -242
  5. package/built/targetlight.json +5 -5
  6. package/built/theme.json +3 -2
  7. package/docs/gamejam/global-2021.html +459 -0
  8. package/docs/hardware.md +1 -1
  9. package/docs/hour-of-code/all.md +27 -0
  10. package/docs/hour-of-code/{educators.html → educators-2020.html} +25 -25
  11. package/docs/hour-of-code/educators-2021.html +625 -0
  12. package/docs/{hour-of-code.html → hour-of-code-2020.html} +37 -37
  13. package/docs/hour-of-code-2021.html +438 -183
  14. package/docs/hour-of-code-ref.json +3 -0
  15. package/docs/index-ref.json +1 -1
  16. package/docs/multipart-tutorials.md +0 -8
  17. package/docs/projects/SUMMARY.md +4 -3
  18. package/docs/recipes.md +0 -7
  19. package/docs/skillmap/clicker/clicker1.md +7 -7
  20. package/docs/skillmap/clicker/clicker2.md +9 -9
  21. package/docs/skillmap/clicker/clicker3.md +8 -8
  22. package/docs/skillmap/clicker/clicker4.md +8 -8
  23. package/docs/skillmap/clicker/clicker4a.md +7 -7
  24. package/docs/skillmap/clicker/clicker5.md +3 -3
  25. package/docs/skillmap/clicker-themed/clickert1.md +66 -38
  26. package/docs/skillmap/clicker-themed/clickert2.md +77 -58
  27. package/docs/skillmap/clicker-themed/clickert3.md +75 -55
  28. package/docs/skillmap/clicker-themed/clickert4.md +105 -118
  29. package/docs/skillmap/collector/collector1.md +11 -11
  30. package/docs/skillmap/collector/collector1a.md +8 -8
  31. package/docs/skillmap/collector/collector2.md +8 -8
  32. package/docs/skillmap/collector/collector3.md +8 -8
  33. package/docs/skillmap/collector/collector3a.md +7 -7
  34. package/docs/skillmap/collector/collector4.md +8 -8
  35. package/docs/skillmap/collector/collector5.md +2 -2
  36. package/docs/skillmap/collector-themed/collectort1.md +107 -88
  37. package/docs/skillmap/collector-themed/collectort2.md +109 -87
  38. package/docs/skillmap/collector-themed/collectort3.md +138 -115
  39. package/docs/skillmap/collector-themed/collectort4.md +130 -118
  40. package/docs/skillmap/collector-themed/collectort4old.md +23 -23
  41. package/docs/skillmap/collector-themed/collectort5.md +2 -2
  42. package/docs/skillmap/educator-info/forest-map-info.md +70 -21
  43. package/docs/skillmap/educator-info/pongo-map-info.md +55 -0
  44. package/docs/skillmap/educator-info/racer-map-info.md +105 -0
  45. package/docs/skillmap/educator-info/rockstar-map-info.md +1 -1
  46. package/docs/skillmap/educator-info/simple-shark-map-info.md +101 -0
  47. package/docs/skillmap/forest/forest1.md +8 -75
  48. package/docs/skillmap/forest/forest2.md +7 -67
  49. package/docs/skillmap/forest/forest3.md +3 -176
  50. package/docs/skillmap/forest/forest4.md +9 -337
  51. package/docs/skillmap/forest/forest5.md +5 -398
  52. package/docs/skillmap/forest/forest6.md +11 -407
  53. package/docs/skillmap/forest-old.md +92 -0
  54. package/docs/skillmap/forest.md +10 -10
  55. package/docs/skillmap/forest_new/forest1.md +191 -0
  56. package/docs/skillmap/forest_new/forest2.md +217 -0
  57. package/docs/skillmap/forest_new/forest3.md +333 -0
  58. package/docs/skillmap/forest_new/forest4.md +196 -0
  59. package/docs/skillmap/forest_new/forest5.md +291 -0
  60. package/docs/skillmap/forest_new/forest6.md +272 -0
  61. package/docs/skillmap/interface/activity1.md +41 -49
  62. package/docs/skillmap/jungle/jungle1.md +48 -28
  63. package/docs/skillmap/jungle/jungle2.md +50 -26
  64. package/docs/skillmap/jungle/jungle3.md +48 -27
  65. package/docs/skillmap/jungle/jungle4.md +76 -58
  66. package/docs/skillmap/jungle/jungle5.md +31 -25
  67. package/docs/skillmap/jungle/jungle6.md +34 -28
  68. package/docs/skillmap/jungle/jungle7.md +36 -24
  69. package/docs/skillmap/jungle/jungle8.md +27 -25
  70. package/docs/skillmap/jungle.md +7 -3
  71. package/docs/skillmap/long-shark.md +119 -0
  72. package/docs/skillmap/pongo/pongo1.md +256 -0
  73. package/docs/skillmap/pongo/pongo2.md +179 -0
  74. package/docs/skillmap/pongo/pongo3.md +177 -0
  75. package/docs/skillmap/pongo.md +59 -0
  76. package/docs/skillmap/racer.md +7 -7
  77. package/docs/skillmap/rockstar/rockstar1.md +32 -41
  78. package/docs/skillmap/rockstar/rockstar2.md +45 -27
  79. package/docs/skillmap/rockstar/rockstar3.md +45 -27
  80. package/docs/skillmap/rockstar.md +3 -1
  81. package/docs/skillmap/shark/shark1-simple.md +151 -0
  82. package/docs/skillmap/shark/shark2-simple.md +203 -0
  83. package/docs/skillmap/shark/shark3-simple.md +204 -0
  84. package/docs/skillmap/shark/shark4-simple.md +246 -0
  85. package/docs/skillmap/shark/shark4a-simple.md +244 -0
  86. package/docs/skillmap/shark.md +25 -58
  87. package/docs/skillmap/space/space1.md +63 -29
  88. package/docs/skillmap/space/space2.md +34 -25
  89. package/docs/skillmap/space/space3.md +86 -69
  90. package/docs/skillmap/space/space4.md +96 -65
  91. package/docs/skillmap/space/space4a.md +34 -25
  92. package/docs/skillmap/space/space5.md +81 -45
  93. package/docs/skillmap/space/space6.md +59 -81
  94. package/docs/skillmap/space.md +8 -5
  95. package/docs/skillmap/story/card.md +6 -6
  96. package/docs/skillmap/story/card2.md +6 -6
  97. package/docs/skillmap/story/story1.md +60 -175
  98. package/docs/skillmap/story/story2.md +89 -327
  99. package/docs/skillmap/story/story3.md +238 -228
  100. package/docs/skillmap/story/story4.md +23 -23
  101. package/docs/skillmap/zoo/zoo1.md +31 -16
  102. package/docs/skillmap/zoo/zoo2.md +45 -30
  103. package/docs/skillmap/zoo/zoo2a.md +51 -36
  104. package/docs/skillmap/zoo/zoo3.md +8 -7
  105. package/docs/skillmap/zoo/zoo4.md +61 -32
  106. package/docs/skillmap/zoo/zoo5.md +41 -31
  107. package/docs/skillmap/zoo.md +2 -2
  108. package/docs/skillmaps.md +20 -4
  109. package/docs/static/experiments/accessibleblocks.png +0 -0
  110. package/docs/static/experiments/blockserrorlist.png +0 -0
  111. package/docs/static/gamejam/jams/global-2021/assets/banner.png +0 -0
  112. package/docs/static/gamejam/jams/global-2021/info.json +10 -0
  113. package/docs/static/gamejam/jams/global-2021/rules.md +22 -0
  114. package/docs/static/gamejam/jams/global-2021/style.css +141 -0
  115. package/docs/static/gamejam/lib/gamejam.d.ts +1 -0
  116. package/docs/static/gamejam/lib/gamejam.js +34 -24
  117. package/docs/static/gamejam/lib/gamejam.ts +35 -24
  118. package/docs/static/hero-gallery/stream.png +0 -0
  119. package/docs/static/hour-of-code/{apple.png → 2020/apple.png} +0 -0
  120. package/docs/static/hour-of-code/{arcade.png → 2020/arcade.png} +0 -0
  121. package/docs/static/hour-of-code/{asphodel.png → 2020/asphodel.png} +0 -0
  122. package/docs/static/hour-of-code/{card.png → 2020/card.png} +0 -0
  123. package/docs/static/hour-of-code/{chase-the-pizza.png → 2020/chase-the-pizza.png} +0 -0
  124. package/docs/static/hour-of-code/{clovers.png → 2020/clovers.png} +0 -0
  125. package/docs/static/hour-of-code/{design.png → 2020/design.png} +0 -0
  126. package/docs/static/hour-of-code/{educators → 2020/educators}/asphodel-level1.png +0 -0
  127. package/docs/static/hour-of-code/{educators → 2020/educators}/asphodel-level4.png +0 -0
  128. package/docs/static/hour-of-code/{educators → 2020/educators}/asphodel-level6.png +0 -0
  129. package/docs/static/hour-of-code/{educators → 2020/educators}/asphodel-level7.png +0 -0
  130. package/docs/static/hour-of-code/{educators → 2020/educators}/asphodel-level9.png +0 -0
  131. package/docs/static/hour-of-code/{educators → 2020/educators}/clover-design.gif +0 -0
  132. package/docs/static/hour-of-code/{educators → 2020/educators}/shark-attack-tutorial.png +0 -0
  133. package/docs/static/hour-of-code/{galga.png → 2020/galga.png} +0 -0
  134. package/docs/static/hour-of-code/{lemon-leak.png → 2020/lemon-leak.png} +0 -0
  135. package/docs/static/hour-of-code/{micro-bit.png → 2020/micro-bit.png} +0 -0
  136. package/docs/static/hour-of-code/{minecraft.png → 2020/minecraft.png} +0 -0
  137. package/docs/static/hour-of-code/{nfl.png → 2020/nfl.png} +0 -0
  138. package/docs/static/hour-of-code/{ocean-jam.png → 2020/ocean-jam.png} +0 -0
  139. package/docs/static/hour-of-code/{pixel-background-primary.png → 2020/pixel-background-primary.png} +0 -0
  140. package/docs/static/hour-of-code/{pixel-background-secondary.png → 2020/pixel-background-secondary.png} +0 -0
  141. package/docs/static/hour-of-code/{shadowed-aside-frame.png → 2020/shadowed-aside-frame.png} +0 -0
  142. package/docs/static/hour-of-code/{shadowed-button-frame.png → 2020/shadowed-button-frame.png} +0 -0
  143. package/docs/static/hour-of-code/{shadowed-primary-frame.png → 2020/shadowed-primary-frame.png} +0 -0
  144. package/docs/static/hour-of-code/{shark-attack.png → 2020/shark-attack.png} +0 -0
  145. package/docs/static/hour-of-code/{simulator.gif → 2020/simulator.gif} +0 -0
  146. package/docs/static/hour-of-code/{simulator.png → 2020/simulator.png} +0 -0
  147. package/docs/static/hour-of-code/{styles.css → 2020/styles.css} +1 -1
  148. package/docs/static/hour-of-code/2021/Rowdies/OFL.txt +93 -0
  149. package/docs/static/hour-of-code/2021/Rowdies/Rowdies-Bold.ttf +0 -0
  150. package/docs/static/hour-of-code/2021/Rowdies/Rowdies-Regular.ttf +0 -0
  151. package/docs/static/hour-of-code/2021/beginner-skillmap.png +0 -0
  152. package/docs/static/hour-of-code/2021/favicon.png +0 -0
  153. package/docs/static/hour-of-code/2021/forest-skillmap-game.gif +0 -0
  154. package/docs/static/hour-of-code/2021/game-jam-hero.png +0 -0
  155. package/docs/static/hour-of-code/2021/hoc-2020.png +0 -0
  156. package/docs/static/hour-of-code/2021/hoc-card.png +0 -0
  157. package/docs/static/hour-of-code/2021/hoc-header-educators.png +0 -0
  158. package/docs/static/hour-of-code/2021/hoc-header-plane.gif +0 -0
  159. package/docs/static/hour-of-code/2021/hoc-header-scene.gif +0 -0
  160. package/docs/static/hour-of-code/2021/jungle-skillmap.png +0 -0
  161. package/docs/static/hour-of-code/2021/makecode-example.png +0 -0
  162. package/docs/static/hour-of-code/2021/microbit.png +0 -0
  163. package/docs/static/hour-of-code/2021/minecraft.png +0 -0
  164. package/docs/static/hour-of-code/2021/rockstar-skillmap.png +0 -0
  165. package/docs/static/hour-of-code/2021/styles.css +660 -62
  166. package/docs/static/logo.png +0 -0
  167. package/docs/static/skillmap/assets/my-assets-three.png +0 -0
  168. package/docs/static/skillmap/assets/my-assets.png +0 -0
  169. package/docs/static/skillmap/assets/sprite-from-container.gif +0 -0
  170. package/docs/static/skillmap/backgrounds/jungle-bg.png +0 -0
  171. package/docs/static/skillmap/backgrounds/jungle-map.png +0 -0
  172. package/docs/static/skillmap/backgrounds/rock-map.png +0 -0
  173. package/docs/static/skillmap/backgrounds/rockstar-card.gif +0 -0
  174. package/docs/static/skillmap/backgrounds/space-comp.png +0 -0
  175. package/docs/static/skillmap/backgrounds/space.png +0 -0
  176. package/docs/static/skillmap/certificates/forest-cert.pdf +0 -0
  177. package/docs/static/skillmap/certificates/forest-cert.png +0 -0
  178. package/docs/static/skillmap/certificates/jungle-cert.pdf +0 -0
  179. package/docs/static/skillmap/certificates/jungle-cert.png +0 -0
  180. package/docs/static/skillmap/certificates/rockstar-cert.pdf +0 -0
  181. package/docs/static/skillmap/certificates/rockstar-cert.png +0 -0
  182. package/docs/static/skillmap/certificates/shark-cert.pdf +0 -0
  183. package/docs/static/skillmap/certificates/shark-cert.png +0 -0
  184. package/docs/static/skillmap/certificates/space-cert.pdf +0 -0
  185. package/docs/static/skillmap/certificates/space-cert.png +0 -0
  186. package/docs/static/skillmap/forest/forest1.gif +0 -0
  187. package/docs/static/skillmap/forest/forest2.gif +0 -0
  188. package/docs/static/skillmap/forest/forest3.gif +0 -0
  189. package/docs/static/skillmap/forest/forest4.gif +0 -0
  190. package/docs/static/skillmap/forest/forest5.gif +0 -0
  191. package/docs/static/skillmap/forest/forest6.gif +0 -0
  192. package/docs/static/skillmap/pongo/pongo1.gif +0 -0
  193. package/docs/static/skillmap/pongo/pongo2gif +0 -0
  194. package/docs/static/skillmap/pongo/pongo3.gif +0 -0
  195. package/docs/static/skillmap/racer/racer1.gif +0 -0
  196. package/docs/static/skillmap/racer/racer2.gif +0 -0
  197. package/docs/static/skillmap/racer/racer3.gif +0 -0
  198. package/docs/static/skillmap/rockstar/rockstar1.gif +0 -0
  199. package/docs/static/skillmap/rockstar/rockstar2.gif +0 -0
  200. package/docs/static/skillmap/rockstar/rockstar3.gif +0 -0
  201. package/docs/static/skillmap/shark/shark1-simple.gif +0 -0
  202. package/docs/static/skillmap/shark/shark4a-simple.gif +0 -0
  203. package/docs/static/skillmap/zoo/overlaps-food-sprite.gif +0 -0
  204. package/docs/tutorials/barrel-dodger.md +4 -4
  205. package/docs/tutorials/collect-the-clovers.md +2 -2
  206. package/docs/tutorials/froggy.md +105 -90
  207. package/docs/tutorials/hundred.md +400 -0
  208. package/package.json +3 -3
  209. package/pxtarget.json +3 -2
  210. package/targetconfig.json +4 -1
  211. package/docs/recipes/wonder-woman-1984/01-maze.md +0 -291
  212. package/docs/recipes/wonder-woman-1984/02-artifact.md +0 -70
  213. package/docs/recipes/wonder-woman-1984/03-enemies.md +0 -65
  214. package/docs/skillmap/forest/forest9.md +0 -714
  215. package/docs/static/hour-of-code/2021/placeholder.png +0 -0
  216. package/docs/static/hour-of-code/ww-maze.png +0 -0
  217. package/docs/static/recipes/wonder-woman-1984/artifact-preview.png +0 -0
  218. package/docs/static/recipes/wonder-woman-1984/artifacts-location.gif +0 -0
  219. package/docs/static/recipes/wonder-woman-1984/draw-maze-backup.png +0 -0
  220. package/docs/static/recipes/wonder-woman-1984/draw-walls-backup.png +0 -0
  221. package/docs/static/recipes/wonder-woman-1984/end-position.png +0 -0
  222. package/docs/static/recipes/wonder-woman-1984/enemies-location.gif +0 -0
  223. package/docs/static/recipes/wonder-woman-1984/enemies-preview.png +0 -0
  224. package/docs/static/recipes/wonder-woman-1984/fill-maze.gif +0 -0
  225. package/docs/static/recipes/wonder-woman-1984/fill-walls.gif +0 -0
  226. package/docs/static/recipes/wonder-woman-1984/wonder-woman3.png +0 -0
  227. package/docs/static/recipes/wonder-woman-1984/ww-splash3.gif +0 -0
  228. package/docs/static/recipes/wonder-woman-1984/ww-splash3.mp4 +0 -0
  229. package/docs/static/ww84-background.png +0 -0
  230. package/docs/static/ww84-header.png +0 -0
  231. package/docs/ww84.html +0 -276
  232. package/sim/public/locales/zh-CN/bundled-strings.json +0 -1800
  233. package/sim/public/locales/zh-CN/target-strings.json +0 -13
  234. package/sim/public/locales/zh-TW/bundled-strings.json +0 -1903
  235. package/sim/public/locales/zh-TW/target-strings.json +0 -8
@@ -4,6 +4,7 @@
4
4
  ## Welcome @showdialog
5
5
 
6
6
  Computer science is more important to firefighting than ever before.
7
+
7
8
  Let's add a heads-up-display (HUD) to help the pilot get information from their fire database in real-time.
8
9
 
9
10
  ![A HUD can help keep you informed](/static/skillmap/forest/forest5.gif "Look what we're about to do!")
@@ -109,7 +110,7 @@ hud.danger_hud(true)
109
110
 
110
111
  ## 6. Healthy Forests
111
112
 
112
- The crew needs to know how engulfed the forest is. Add another hud
113
+ The crew needs to know the progress of the fire. Add another hud
113
114
  to share information on how much of the forest is still healthy.
114
115
 
115
116
  ---
@@ -223,22 +224,10 @@ and head back out to the skillmap to share it with friends or save it in your ga
223
224
 
224
225
 
225
226
  ```package
226
- pxt-tilemaps=github:microsoft/pxt-tilemaps/
227
- pxt-text=github:microsoft/arcade-text
228
- arcade-premium-life=github:jwunderl/arcade-premium-life/
229
- pxt-characterAnimations=github:microsoft/arcade-character-animations/
230
- pxt-data=github:microsoft/arcade-sprite-data/
231
- pxt-story=github:microsoft/arcade-storytelling/
232
- arcade-sprite-util=github:jwunderl/arcade-sprite-util/
233
- pxt-status-bar=github:jwunderl/pxt-status-bar
227
+ pxt-forest-special=github:kiki-lee/forest-special/
234
228
  ```
235
229
 
236
230
  ```template
237
- namespace SpriteKind {
238
- export const Water = SpriteKind.create()
239
- export const Fire = SpriteKind.create()
240
- export const Burnt = SpriteKind.create()
241
- }
242
231
 
243
232
  controller.A.onEvent(ControllerButtonEvent.Repeated, function () {
244
233
  sprites.spray(mySprite, assets.image`water`)
@@ -271,12 +260,12 @@ sprites.onOverlap(SpriteKind.Fire, SpriteKind.Fire, function (sprite, otherSprit
271
260
  sprite.destroy()
272
261
  })
273
262
 
274
- scene.onOverlapTile(SpriteKind.Fire, assets.tile`smoulder`, function (sprite, location) {
263
+ scene.onOverlapTile(SpriteKind.Fire, assets.tile`burnt tree`, function (sprite, location) {
275
264
  sprite.destroy()
276
265
  })
277
266
 
278
267
  sprites.onDestroyed(SpriteKind.Fire, function (sprite) {
279
- tiles.setTileAt(tiles.locationOfSprite(sprite), assets.tile`smoulder`)
268
+ tiles.setTileAt(tiles.locationOfSprite(sprite), assets.tile`burnt tree`)
280
269
  })
281
270
 
282
271
  game.onUpdate(function () {
@@ -314,388 +303,6 @@ hud.fire_hud_label ("Nope:")
314
303
  ```
315
304
 
316
305
 
317
- ```customts
318
-
319
- let spreadOptions: number[] = []
320
-
321
- let windSpeed = 5
322
- let tinder = 4
323
- let dryGrass = 5
324
- let spreadTimeBase = 2000
325
- let hoseDirection = 270
326
- let facing = 0
327
- let changeRate = 7
328
- let burnedColor = 2
329
- let healthyColor = 3
330
-
331
- let statusbar = statusbars.create(82, 4, StatusBarKind.Health)
332
- statusbar.top = 12
333
- statusbar.left = 4
334
- statusbar.max = tiles.tilemapRows() * tiles.tilemapColumns()
335
- statusbar.value = tiles.tilemapRows() * tiles.tilemapColumns()
336
- statusbar.setColor(healthyColor, burnedColor)
337
- let statusLabel = textsprite.create("Healthy Forest", 0, 1)
338
- statusLabel.setFlag(SpriteFlag.RelativeToCamera, true)
339
- statusLabel.top = 2
340
- statusLabel.left = 4
341
- let fireLabel = textsprite.create("Fires:")
342
- fireLabel.right = 145
343
- fireLabel.top = 2
344
- fireLabel.setMaxFontHeight(4)
345
- fireLabel.setFlag(SpriteFlag.RelativeToCamera, true)
346
- let hudBG = sprites.create(img`
347
- cccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccc
348
- cccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccc
349
- cccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccc
350
- cccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccc
351
- cccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccc
352
- cccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccc
353
- cccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccc
354
- cccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccc
355
- cccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccc
356
- cccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccc
357
- `, SpriteKind.Player)
358
- hudBG.bottom = 120
359
- hudBG.z = 2000
360
- hudBG.setFlag(SpriteFlag.Invisible, true)
361
- let statusbar2 = statusbars.create(8, 8, StatusBarKind.Magic)
362
- statusbar2.setLabel("Fire Danger:")
363
- statusbar2.setColor(7, 2)
364
- statusbar2.positionDirection(CollisionDirection.Bottom)
365
- statusbar2.z = 2001
366
- statusLabel.setFlag(SpriteFlag.Invisible, true)
367
- statusbar.setFlag(SpriteFlag.Invisible, true)
368
- fireLabel.setFlag(SpriteFlag.Invisible, true)
369
- info.showScore(false)
370
- statusbar2.setFlag(SpriteFlag.Invisible, true)
371
-
372
-
373
-
374
- game.onUpdate(function () {
375
- statusbar.max = tiles.tilemapRows() * tiles.tilemapColumns()
376
- statusbar.value = tiles.tilemapRows() * tiles.tilemapColumns() - tiles.getTilesByType(assets.tile`smoulder`).length
377
- spreadTimeBase = 4500 - (250 * windSpeed + 250 * dryGrass - 100 * tinder)
378
- if (spreadTimeBase >= 4000) {
379
- statusbar2.setColor(7, 2)
380
- } else if (spreadTimeBase >= 3000) {
381
- statusbar2.setColor(5, 2)
382
- } else if (spreadTimeBase >= 2000) {
383
- statusbar2.setColor(4, 2)
384
- } else {
385
- statusbar2.setColor(2, 2)
386
- }
387
- if (sprites.allOfKind(SpriteKind.Fire).length <= 0) {
388
- hud.fire_hud(false)
389
- info.setScore(statusbar.value / statusbar.max * 100)
390
- game.splash("You saved " + convertToText(info.score()) + "% of the forest!")
391
- game.over(true)
392
- } else {
393
- info.setScore(sprites.allOfKind(SpriteKind.Fire).length)
394
- }
395
- })
396
-
397
-
398
-
399
- namespace animation {
400
- /*
401
- * Loops the passed frames on the sprite at the given interval whenever
402
- * the specified rule is true for that sprite.
403
- *
404
- * If more than one rule applies, the most specific rule will be used.
405
- * If multiple rules are equally specific, the currently executing rule
406
- * is favored (or one is chosen at random).
407
- *
408
- * @param sprite the sprite to animate
409
- * @param frames the images that make up that animation
410
- * @param frame Interval the amount of time to spend on each frame in milliseconds
411
- * @param rule the rule that decides when this animation will play
412
- */
413
- //% blockId=arcade_character_loop_frames2
414
- //% block="animate $sprite loop frames $frames interval (ms) $frameInterval when $rule"
415
- //% sprite.defl=mySprite
416
- //% frames.defl=Fire Plane Right
417
- //% sprite.shadow=variables_get
418
- //% frames.shadow=animation_editor
419
- //% frameInterval.shadow=timePicker
420
- //% rule.shadow=arcade_character_make_rule
421
- //% weight=100
422
- //% blockGap=8
423
- //% help=github:arcade-character-animations/docs/loop-character-animation
424
- export function loopFrames2(sprite: Sprite, frames: Image[], frameInterval: number, rule: number) {
425
- characterAnimations.loopFrames(sprite, frames, frameInterval, rule);
426
- }
427
- }
428
-
429
-
430
- namespace game {
431
-
432
- /*
433
- * Set the strength of your wind.
434
- * Higher numbers spread fire faster.
435
- */
436
- //% block="set strength of wind to $num"
437
- //% num.defl=3
438
- export function set_strength_of_wind (num: number) {
439
- windSpeed = num
440
- }
441
-
442
- /*
443
- * Set the health of your trees.
444
- * Lower numbers spread fire faster.
445
- */
446
- //% block="set health of trees to $num"
447
- //% num.defl=7
448
- export function set_health_of_trees (num: number) {
449
- tinder = num
450
- }
451
-
452
- /*
453
- * Set how dry your grass is.
454
- * Higher numbers spread fire faster.
455
- */
456
- //% block="set dryness of grass to $num"
457
- //% num.defl=3
458
- export function set_dryness_of_grass (num: number) {
459
- dryGrass = num
460
- }
461
- }
462
-
463
- //% color="#09282d" icon="\uf1e5"
464
- //% block="HUD"
465
- namespace hud {
466
-
467
- /*
468
- * Show or hide the current number of burning fires.
469
- */
470
- //% block="show fire HUD $answer"
471
- //% answer.shadow="toggleYesNo"
472
- //% answer.defl=true
473
- export function fire_hud (answer: boolean) {
474
-
475
- if (answer) {
476
- fireLabel.setFlag(SpriteFlag.Invisible, false)
477
- info.showScore(true)
478
- } else {
479
- fireLabel.setFlag(SpriteFlag.Invisible, true)
480
- info.showScore(false)
481
- }
482
-
483
- }
484
-
485
- /*
486
- * Show or hide how much of the forest has burned.
487
- */
488
- //% block="show forest HUD $answer"
489
- //% answer.shadow="toggleYesNo"
490
- //% answer.defl=true
491
- export function forest_hud (answer: boolean) {
492
-
493
- if (answer) {
494
- statusLabel.setFlag(SpriteFlag.Invisible, false)
495
- statusbar.setFlag(SpriteFlag.Invisible, false)
496
-
497
- } else {
498
- statusLabel.setFlag(SpriteFlag.Invisible, true)
499
- statusbar.setFlag(SpriteFlag.Invisible, true)
500
- }
501
-
502
- }
503
-
504
-
505
- /*
506
- * Show or hide the fire danger level.
507
- */
508
- //% block="show danger level HUD $answer"
509
- //% answer.shadow="toggleYesNo"
510
- //% answer.defl=true
511
- export function danger_hud (answer: boolean) {
512
-
513
- if (answer) {
514
- hudBG.setFlag(SpriteFlag.Invisible, false)
515
- statusbar2.setFlag(SpriteFlag.Invisible, false)
516
-
517
- } else {
518
- hudBG.setFlag(SpriteFlag.Invisible, true)
519
- statusbar2.setFlag(SpriteFlag.Invisible, true)
520
- }
521
-
522
- }
523
-
524
-
525
-
526
- /*
527
- * Set the color for remaining live forest
528
- */
529
- //% block="set color of healthy forest meter to $color"
530
- //% color.shadow="colorindexpicker"
531
- //% color.defl=3
532
- export function forest_hud_healthy (color: number) {
533
- healthyColor = color
534
- statusbar.setColor(healthyColor, burnedColor)
535
- }
536
-
537
- /*
538
- * Set the color for burned forest
539
- */
540
- //% block="set color of burned forest meter to $color"
541
- //% color.shadow="colorindexpicker"
542
- //% color.defl=2
543
- export function forest_hud_burned (color: number) {
544
- burnedColor = color
545
- statusbar.setColor(healthyColor, burnedColor)
546
- }
547
-
548
-
549
- /*
550
- * Set the label for the forest HUD
551
- */
552
- //% block="set forest HUD label to $name"
553
- //% name.defl="Healthy Forest"
554
- export function forest_hud_label (name: string) {
555
- statusLabel.setText(name)
556
- }
557
-
558
-
559
- /*
560
- * Set the label for the fire-counting HUD
561
- */
562
- //% block="set fire HUD label to $name"
563
- //% name.defl="Fires:"
564
- export function fire_hud_label (name: string) {
565
- fireLabel.setText(name)
566
- }
567
-
568
-
569
- /*
570
- * Set the label for the fire danger HUD
571
- */
572
- //% block="set danger HUD label to $name"
573
- //% name.defl="Fire Danger Levels"
574
- export function danger_hud_label (name: string) {
575
- statusbar2.setLabel(name)
576
- }
577
-
578
-
579
- }
580
-
581
- namespace sprites {
582
-
583
- /*
584
- * Set the number of "lives" for your sprite.
585
- */
586
- //% block="set strength of $thisSprite=variables_get(mySprite) to $num"
587
- //% num.defl=10
588
- export function set_flame_strength (thisSprite: Sprite, num: number) {
589
- sprites.setDataNumber(thisSprite, "life", num)
590
- sprites.setDataNumber(thisSprite, "spreadTime", spreadTimeBase + 1000)
591
- }
592
-
593
- /*
594
- * Add or remove "lives" from your sprite.
595
- */
596
- //% block="change strength of $thisSprite=variables_get(mySprite) by $num"
597
- //% num.defl=-1
598
- export function change_flame_strength_by (thisSprite: Sprite, num: number) {
599
- sprites.changeDataNumberBy(thisSprite, "life", num)
600
- for (let value of sprites.allOfKind(SpriteKind.Fire)) {
601
- if (sprites.readDataNumber(value, "life") <= 0) {
602
- effects.clearParticles(value)
603
- value.destroy()
604
- }
605
- }
606
- }
607
-
608
- /*
609
- * Choose a sprite to "spray" an image (in sprite form.)
610
- */
611
- //% block="spray from $thisSprite=variables_get(mySprite) using $img=screen_image_picker"
612
- //% img.defl=water
613
- export function spray (thisSprite: Sprite, img: Image) {
614
-
615
- if (controller.up.isPressed()) {
616
- if (controller.left.isPressed()) {
617
- facing = 225
618
- } else if (controller.right.isPressed()) {
619
- facing = 315
620
- } else if (controller.down.isPressed()) {
621
-
622
- } else {
623
- facing = 270
624
- }
625
- } else if (controller.left.isPressed()) {
626
- if (controller.right.isPressed()) {
627
-
628
- } else if (controller.down.isPressed()) {
629
- facing = 135
630
- } else {
631
- facing = 180
632
- }
633
- } else if (controller.right.isPressed()) {
634
- if (controller.down.isPressed()) {
635
- facing = 45
636
- } else {
637
- facing = 0
638
- }
639
- } else if (controller.down.isPressed()) {
640
- facing = 90
641
- }
642
-
643
- if (Math.abs(facing - hoseDirection) < 180) {
644
- if (facing < hoseDirection) {
645
- hoseDirection += 0 - changeRate
646
- } else {
647
- hoseDirection += changeRate
648
- }
649
- } else{
650
- if (facing < hoseDirection) {
651
- hoseDirection += changeRate
652
- } else {
653
- hoseDirection += 0 - changeRate
654
- }
655
- if (hoseDirection < 0) {
656
- hoseDirection += 360
657
- } else if (hoseDirection > 360) {
658
- hoseDirection += -360
659
- }
660
- hoseDirection = hoseDirection % 360
661
- }
662
- let waterProj = sprites.createProjectileFromSprite(img, thisSprite, 150 * Math.cos(spriteutils.degreesToRadians(hoseDirection)), 150 * Math.sin(spriteutils.degreesToRadians(hoseDirection)))
663
- waterProj.setKind(SpriteKind.Water)
664
- }
665
-
666
- /*
667
- * Spread current fires according to wind speed,
668
- * dryness of grass, and health of trees.
669
- */
670
- //% block="random spread $myImage=screen_image_picker"
671
- export function random_spread (myImage: Image) {
672
-
673
- for (let value of sprites.allOfKind(SpriteKind.Fire)) {
674
- if (sprites.readDataNumber(value, "life") <= 0) {
675
- effects.clearParticles(value)
676
- value.destroy()
677
- }
678
-
679
- let list2 = [-32,-16,0,16,32,16,-16]
680
- if (game.runtime() > sprites.readDataNumber(value, "spreadTime")) {
681
- sprites.setDataNumber(value, "spreadTime", game.runtime() + randint(spreadTimeBase, spreadTimeBase + 1000))
682
- let newFire = sprites.create(myImage, SpriteKind.Fire)
683
- newFire.setPosition(value.x + list2._pickRandom(), value.y)
684
- sprites.setDataNumber(newFire, "spreadTime", game.runtime() + randint(spreadTimeBase, spreadTimeBase + 1000))
685
- if (Math.percentChance(50)) {
686
- newFire.y += list2._pickRandom()
687
- }
688
- if (tiles.tileIsWall(tiles.locationOfSprite(newFire))) {
689
- newFire.setPosition(value.x, value.y)
690
- }
691
- }
692
- }
693
- }
694
-
695
- }
696
- ```
697
-
698
-
699
306
  ```assetjson
700
307
  {
701
308
  "README.md": " ",