pxt-arcade 1.7.3 → 1.7.7
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/common-sim.d.ts +2 -0
- package/built/common-sim.js +4 -0
- package/built/target.js +1788 -236
- package/built/target.json +1788 -236
- package/built/targetlight.json +5 -5
- package/built/theme.json +3 -2
- package/docs/gamejam/global-2021.html +459 -0
- package/docs/hour-of-code/all.md +27 -0
- package/docs/hour-of-code/{educators.html → educators-2020.html} +25 -25
- package/docs/hour-of-code/educators-2021.html +625 -0
- package/docs/{hour-of-code.html → hour-of-code-2020.html} +37 -37
- package/docs/hour-of-code-2021.html +438 -183
- package/docs/hour-of-code-ref.json +3 -0
- package/docs/index-ref.json +1 -1
- package/docs/multipart-tutorials.md +0 -8
- package/docs/projects/SUMMARY.md +3 -2
- package/docs/recipes.md +0 -7
- package/docs/skillmap/clicker/clicker1.md +7 -7
- package/docs/skillmap/clicker/clicker2.md +9 -9
- package/docs/skillmap/clicker/clicker3.md +8 -8
- package/docs/skillmap/clicker/clicker4.md +8 -8
- package/docs/skillmap/clicker/clicker4a.md +7 -7
- package/docs/skillmap/clicker/clicker5.md +3 -3
- package/docs/skillmap/clicker-themed/clickert1.md +66 -38
- package/docs/skillmap/clicker-themed/clickert2.md +77 -58
- package/docs/skillmap/clicker-themed/clickert3.md +75 -55
- package/docs/skillmap/clicker-themed/clickert4.md +105 -118
- package/docs/skillmap/collector/collector1.md +11 -11
- package/docs/skillmap/collector/collector1a.md +8 -8
- package/docs/skillmap/collector/collector2.md +8 -8
- package/docs/skillmap/collector/collector3.md +8 -8
- package/docs/skillmap/collector/collector3a.md +7 -7
- package/docs/skillmap/collector/collector4.md +8 -8
- package/docs/skillmap/collector/collector5.md +2 -2
- package/docs/skillmap/collector-themed/collectort1.md +107 -88
- package/docs/skillmap/collector-themed/collectort2.md +109 -87
- package/docs/skillmap/collector-themed/collectort3.md +138 -115
- package/docs/skillmap/collector-themed/collectort4.md +130 -118
- package/docs/skillmap/collector-themed/collectort4old.md +23 -23
- package/docs/skillmap/collector-themed/collectort5.md +2 -2
- package/docs/skillmap/educator-info/forest-map-info.md +34 -25
- package/docs/skillmap/educator-info/pongo-map-info.md +55 -0
- package/docs/skillmap/educator-info/racer-map-info.md +105 -0
- package/docs/skillmap/educator-info/rockstar-map-info.md +1 -1
- package/docs/skillmap/educator-info/simple-shark-map-info.md +101 -0
- package/docs/skillmap/forest/forest1.md +1 -69
- package/docs/skillmap/forest/forest2.md +5 -65
- package/docs/skillmap/forest/forest3.md +1 -174
- package/docs/skillmap/forest/forest4.md +2 -336
- package/docs/skillmap/forest/forest5.md +1 -396
- package/docs/skillmap/forest/forest6.md +6 -372
- package/docs/skillmap/forest-old.md +92 -0
- package/docs/skillmap/forest.md +9 -9
- package/docs/skillmap/forest_new/forest1.md +191 -0
- package/docs/skillmap/forest_new/forest2.md +217 -0
- package/docs/skillmap/forest_new/forest3.md +333 -0
- package/docs/skillmap/forest_new/forest4.md +196 -0
- package/docs/skillmap/forest_new/forest5.md +291 -0
- package/docs/skillmap/forest_new/forest6.md +272 -0
- package/docs/skillmap/interface/activity1.md +41 -49
- package/docs/skillmap/jungle/jungle1.md +48 -28
- package/docs/skillmap/jungle/jungle2.md +50 -26
- package/docs/skillmap/jungle/jungle3.md +48 -27
- package/docs/skillmap/jungle/jungle4.md +76 -58
- package/docs/skillmap/jungle/jungle5.md +31 -25
- package/docs/skillmap/jungle/jungle6.md +34 -28
- package/docs/skillmap/jungle/jungle7.md +36 -24
- package/docs/skillmap/jungle/jungle8.md +27 -25
- package/docs/skillmap/jungle.md +7 -3
- package/docs/skillmap/long-shark.md +119 -0
- package/docs/skillmap/pongo/pongo1.md +256 -0
- package/docs/skillmap/pongo/pongo2.md +179 -0
- package/docs/skillmap/pongo/pongo3.md +177 -0
- package/docs/skillmap/pongo.md +59 -0
- package/docs/skillmap/racer.md +7 -7
- package/docs/skillmap/rockstar/rockstar1.md +32 -41
- package/docs/skillmap/rockstar/rockstar2.md +45 -27
- package/docs/skillmap/rockstar/rockstar3.md +45 -27
- package/docs/skillmap/rockstar.md +3 -1
- package/docs/skillmap/shark/shark1-simple.md +151 -0
- package/docs/skillmap/shark/shark2-simple.md +203 -0
- package/docs/skillmap/shark/shark3-simple.md +204 -0
- package/docs/skillmap/shark/shark4-simple.md +246 -0
- package/docs/skillmap/shark/shark4a-simple.md +244 -0
- package/docs/skillmap/shark.md +25 -58
- package/docs/skillmap/space/space1.md +63 -29
- package/docs/skillmap/space/space2.md +34 -25
- package/docs/skillmap/space/space3.md +86 -69
- package/docs/skillmap/space/space4.md +96 -65
- package/docs/skillmap/space/space4a.md +34 -25
- package/docs/skillmap/space/space5.md +81 -45
- package/docs/skillmap/space/space6.md +59 -81
- package/docs/skillmap/space.md +8 -5
- package/docs/skillmap/story/card.md +6 -6
- package/docs/skillmap/story/card2.md +6 -6
- package/docs/skillmap/story/story1.md +60 -175
- package/docs/skillmap/story/story2.md +89 -327
- package/docs/skillmap/story/story3.md +238 -228
- package/docs/skillmap/story/story4.md +23 -23
- package/docs/skillmap/zoo/zoo1.md +31 -16
- package/docs/skillmap/zoo/zoo2.md +45 -30
- package/docs/skillmap/zoo/zoo2a.md +51 -36
- package/docs/skillmap/zoo/zoo3.md +8 -7
- package/docs/skillmap/zoo/zoo4.md +61 -32
- package/docs/skillmap/zoo/zoo5.md +41 -31
- package/docs/skillmap/zoo.md +2 -2
- package/docs/skillmaps.md +20 -4
- package/docs/static/experiments/accessibleblocks.png +0 -0
- package/docs/static/experiments/blockserrorlist.png +0 -0
- package/docs/static/gamejam/jams/global-2021/assets/banner.png +0 -0
- package/docs/static/gamejam/jams/global-2021/info.json +10 -0
- package/docs/static/gamejam/jams/global-2021/rules.md +22 -0
- package/docs/static/gamejam/jams/global-2021/style.css +141 -0
- package/docs/static/gamejam/lib/gamejam.d.ts +1 -0
- package/docs/static/gamejam/lib/gamejam.js +34 -24
- package/docs/static/gamejam/lib/gamejam.ts +35 -24
- package/docs/static/hero-gallery/stream.png +0 -0
- package/docs/static/hour-of-code/{apple.png → 2020/apple.png} +0 -0
- package/docs/static/hour-of-code/{arcade.png → 2020/arcade.png} +0 -0
- package/docs/static/hour-of-code/{asphodel.png → 2020/asphodel.png} +0 -0
- package/docs/static/hour-of-code/{card.png → 2020/card.png} +0 -0
- package/docs/static/hour-of-code/{chase-the-pizza.png → 2020/chase-the-pizza.png} +0 -0
- package/docs/static/hour-of-code/{clovers.png → 2020/clovers.png} +0 -0
- package/docs/static/hour-of-code/{design.png → 2020/design.png} +0 -0
- package/docs/static/hour-of-code/{educators → 2020/educators}/asphodel-level1.png +0 -0
- package/docs/static/hour-of-code/{educators → 2020/educators}/asphodel-level4.png +0 -0
- package/docs/static/hour-of-code/{educators → 2020/educators}/asphodel-level6.png +0 -0
- package/docs/static/hour-of-code/{educators → 2020/educators}/asphodel-level7.png +0 -0
- package/docs/static/hour-of-code/{educators → 2020/educators}/asphodel-level9.png +0 -0
- package/docs/static/hour-of-code/{educators → 2020/educators}/clover-design.gif +0 -0
- package/docs/static/hour-of-code/{educators → 2020/educators}/shark-attack-tutorial.png +0 -0
- package/docs/static/hour-of-code/{galga.png → 2020/galga.png} +0 -0
- package/docs/static/hour-of-code/{lemon-leak.png → 2020/lemon-leak.png} +0 -0
- package/docs/static/hour-of-code/{micro-bit.png → 2020/micro-bit.png} +0 -0
- package/docs/static/hour-of-code/{minecraft.png → 2020/minecraft.png} +0 -0
- package/docs/static/hour-of-code/{nfl.png → 2020/nfl.png} +0 -0
- package/docs/static/hour-of-code/{ocean-jam.png → 2020/ocean-jam.png} +0 -0
- package/docs/static/hour-of-code/{pixel-background-primary.png → 2020/pixel-background-primary.png} +0 -0
- package/docs/static/hour-of-code/{pixel-background-secondary.png → 2020/pixel-background-secondary.png} +0 -0
- package/docs/static/hour-of-code/{shadowed-aside-frame.png → 2020/shadowed-aside-frame.png} +0 -0
- package/docs/static/hour-of-code/{shadowed-button-frame.png → 2020/shadowed-button-frame.png} +0 -0
- package/docs/static/hour-of-code/{shadowed-primary-frame.png → 2020/shadowed-primary-frame.png} +0 -0
- package/docs/static/hour-of-code/{shark-attack.png → 2020/shark-attack.png} +0 -0
- package/docs/static/hour-of-code/{simulator.gif → 2020/simulator.gif} +0 -0
- package/docs/static/hour-of-code/{simulator.png → 2020/simulator.png} +0 -0
- package/docs/static/hour-of-code/{styles.css → 2020/styles.css} +1 -1
- package/docs/static/hour-of-code/2021/Rowdies/OFL.txt +93 -0
- package/docs/static/hour-of-code/2021/Rowdies/Rowdies-Bold.ttf +0 -0
- package/docs/static/hour-of-code/2021/Rowdies/Rowdies-Regular.ttf +0 -0
- package/docs/static/hour-of-code/2021/beginner-skillmap.png +0 -0
- package/docs/static/hour-of-code/2021/favicon.png +0 -0
- package/docs/static/hour-of-code/2021/forest-skillmap-game.gif +0 -0
- package/docs/static/hour-of-code/2021/game-jam-hero.png +0 -0
- package/docs/static/hour-of-code/2021/hoc-2020.png +0 -0
- package/docs/static/hour-of-code/2021/hoc-card.png +0 -0
- package/docs/static/hour-of-code/2021/hoc-header-educators.png +0 -0
- package/docs/static/hour-of-code/2021/hoc-header-plane.gif +0 -0
- package/docs/static/hour-of-code/2021/hoc-header-scene.gif +0 -0
- package/docs/static/hour-of-code/2021/jungle-skillmap.png +0 -0
- package/docs/static/hour-of-code/2021/makecode-example.png +0 -0
- package/docs/static/hour-of-code/2021/microbit.png +0 -0
- package/docs/static/hour-of-code/2021/minecraft.png +0 -0
- package/docs/static/hour-of-code/2021/rockstar-skillmap.png +0 -0
- package/docs/static/hour-of-code/2021/styles.css +660 -62
- package/docs/static/logo.png +0 -0
- package/docs/static/skillmap/assets/my-assets-three.png +0 -0
- package/docs/static/skillmap/assets/sprite-from-container.gif +0 -0
- package/docs/static/skillmap/backgrounds/jungle-bg.png +0 -0
- package/docs/static/skillmap/backgrounds/jungle-map.png +0 -0
- package/docs/static/skillmap/backgrounds/rock-map.png +0 -0
- package/docs/static/skillmap/backgrounds/rockstar-card.gif +0 -0
- package/docs/static/skillmap/backgrounds/space-comp.png +0 -0
- package/docs/static/skillmap/backgrounds/space.png +0 -0
- package/docs/static/skillmap/certificates/forest-cert.pdf +0 -0
- package/docs/static/skillmap/certificates/forest-cert.png +0 -0
- package/docs/static/skillmap/certificates/jungle-cert.pdf +0 -0
- package/docs/static/skillmap/certificates/jungle-cert.png +0 -0
- package/docs/static/skillmap/certificates/rockstar-cert.pdf +0 -0
- package/docs/static/skillmap/certificates/rockstar-cert.png +0 -0
- package/docs/static/skillmap/certificates/shark-cert.pdf +0 -0
- package/docs/static/skillmap/certificates/shark-cert.png +0 -0
- package/docs/static/skillmap/certificates/space-cert.pdf +0 -0
- package/docs/static/skillmap/certificates/space-cert.png +0 -0
- package/docs/static/skillmap/pongo/pongo1.gif +0 -0
- package/docs/static/skillmap/pongo/pongo2gif +0 -0
- package/docs/static/skillmap/pongo/pongo3.gif +0 -0
- package/docs/static/skillmap/racer/racer1.gif +0 -0
- package/docs/static/skillmap/racer/racer2.gif +0 -0
- package/docs/static/skillmap/racer/racer3.gif +0 -0
- package/docs/static/skillmap/rockstar/rockstar1.gif +0 -0
- package/docs/static/skillmap/rockstar/rockstar2.gif +0 -0
- package/docs/static/skillmap/rockstar/rockstar3.gif +0 -0
- package/docs/static/skillmap/shark/shark1-simple.gif +0 -0
- package/docs/static/skillmap/shark/shark4a-simple.gif +0 -0
- package/docs/static/skillmap/zoo/overlaps-food-sprite.gif +0 -0
- package/docs/tutorials/barrel-dodger.md +4 -4
- package/docs/tutorials/collect-the-clovers.md +2 -2
- package/docs/tutorials/froggy.md +105 -90
- package/docs/tutorials/hundred.md +400 -0
- package/package.json +3 -3
- package/pxtarget.json +3 -2
- package/targetconfig.json +4 -1
- package/docs/recipes/wonder-woman-1984/01-maze.md +0 -291
- package/docs/recipes/wonder-woman-1984/02-artifact.md +0 -70
- package/docs/recipes/wonder-woman-1984/03-enemies.md +0 -65
- package/docs/skillmap/forest/forest9.md +0 -714
- package/docs/static/hour-of-code/2021/placeholder.png +0 -0
- package/docs/static/hour-of-code/ww-maze.png +0 -0
- package/docs/static/recipes/wonder-woman-1984/artifact-preview.png +0 -0
- package/docs/static/recipes/wonder-woman-1984/artifacts-location.gif +0 -0
- package/docs/static/recipes/wonder-woman-1984/draw-maze-backup.png +0 -0
- package/docs/static/recipes/wonder-woman-1984/draw-walls-backup.png +0 -0
- package/docs/static/recipes/wonder-woman-1984/end-position.png +0 -0
- package/docs/static/recipes/wonder-woman-1984/enemies-location.gif +0 -0
- package/docs/static/recipes/wonder-woman-1984/enemies-preview.png +0 -0
- package/docs/static/recipes/wonder-woman-1984/fill-maze.gif +0 -0
- package/docs/static/recipes/wonder-woman-1984/fill-walls.gif +0 -0
- package/docs/static/recipes/wonder-woman-1984/wonder-woman3.png +0 -0
- package/docs/static/recipes/wonder-woman-1984/ww-splash3.gif +0 -0
- package/docs/static/recipes/wonder-woman-1984/ww-splash3.mp4 +0 -0
- package/docs/static/ww84-background.png +0 -0
- package/docs/static/ww84-header.png +0 -0
- package/docs/ww84.html +0 -276
- package/sim/public/locales/zh-CN/bundled-strings.json +0 -1800
- package/sim/public/locales/zh-CN/target-strings.json +0 -13
- package/sim/public/locales/zh-TW/bundled-strings.json +0 -1903
- package/sim/public/locales/zh-TW/target-strings.json +0 -8
|
@@ -224,23 +224,14 @@ head to the next level and find out how to put the fires out!
|
|
|
224
224
|
|
|
225
225
|
|
|
226
226
|
|
|
227
|
-
```package
|
|
228
|
-
pxt-tilemaps=github:microsoft/pxt-tilemaps/
|
|
229
|
-
pxt-text=github:microsoft/arcade-text
|
|
230
|
-
arcade-premium-life=github:jwunderl/arcade-premium-life/
|
|
231
|
-
pxt-characterAnimations=github:microsoft/arcade-character-animations/
|
|
232
|
-
pxt-data=github:microsoft/arcade-sprite-data/
|
|
233
|
-
pxt-story=github:microsoft/arcade-storytelling/
|
|
234
|
-
arcade-sprite-util=github:jwunderl/arcade-sprite-util/
|
|
235
|
-
pxt-status-bar=github:jwunderl/pxt-status-bar
|
|
236
|
-
```
|
|
237
|
-
|
|
238
227
|
```template
|
|
239
228
|
namespace SpriteKind {
|
|
229
|
+
|
|
230
|
+
export const Water = SpriteKind.create()
|
|
240
231
|
export const Fire = SpriteKind.create()
|
|
241
232
|
export const Burnt = SpriteKind.create()
|
|
242
|
-
export const Water = SpriteKind.create()
|
|
243
233
|
}
|
|
234
|
+
|
|
244
235
|
tiles.setTilemap(tilemap`level1`)
|
|
245
236
|
let mySprite = sprites.create(assets.image`Fire Plane Right`, SpriteKind.Player)
|
|
246
237
|
controller.moveSprite(mySprite)
|
|
@@ -248,59 +239,8 @@ scene.cameraFollowSprite(mySprite)
|
|
|
248
239
|
|
|
249
240
|
```
|
|
250
241
|
|
|
251
|
-
```
|
|
252
|
-
|
|
253
|
-
let statusbar = statusbars.create(82, 4, StatusBarKind.Health)
|
|
254
|
-
statusbar.top = 12
|
|
255
|
-
statusbar.left = 4
|
|
256
|
-
statusbar.max = tiles.tilemapRows() * tiles.tilemapColumns()
|
|
257
|
-
let statusLabel = textsprite.create("Healthy Forest", 0, 1)
|
|
258
|
-
statusLabel.setFlag(SpriteFlag.RelativeToCamera, true)
|
|
259
|
-
statusLabel.top = 2
|
|
260
|
-
statusLabel.left = 4
|
|
261
|
-
statusbar.setColor(7, 14)
|
|
262
|
-
let fireLabel = textsprite.create("Fires:")
|
|
263
|
-
fireLabel.right = 145
|
|
264
|
-
fireLabel.top = 2
|
|
265
|
-
fireLabel.setMaxFontHeight(4)
|
|
266
|
-
fireLabel.setFlag(SpriteFlag.RelativeToCamera, true)
|
|
267
|
-
statusLabel.setFlag(SpriteFlag.Invisible, true)
|
|
268
|
-
statusbar.setFlag(SpriteFlag.Invisible, true)
|
|
269
|
-
fireLabel.setFlag(SpriteFlag.Invisible, true)
|
|
270
|
-
info.showScore(false)
|
|
271
|
-
|
|
272
|
-
|
|
273
|
-
|
|
274
|
-
|
|
275
|
-
namespace animation {
|
|
276
|
-
/*
|
|
277
|
-
* Loops the passed frames on the sprite at the given interval whenever
|
|
278
|
-
* the specified rule is true for that sprite.
|
|
279
|
-
*
|
|
280
|
-
* If more than one rule applies, the most specific rule will be used.
|
|
281
|
-
* If multiple rules are equally specific, the currently executing rule
|
|
282
|
-
* is favored (or one is chosen at random).
|
|
283
|
-
*
|
|
284
|
-
* @param sprite the sprite to animate
|
|
285
|
-
* @param frames the images that make up that animation
|
|
286
|
-
* @param frame Interval the amount of time to spend on each frame in milliseconds
|
|
287
|
-
* @param rule the rule that decides when this animation will play
|
|
288
|
-
*/
|
|
289
|
-
//% blockId=arcade_character_loop_frames2
|
|
290
|
-
//% block="animate $sprite loop frames $frames interval (ms) $frameInterval when $rule"
|
|
291
|
-
//% sprite.defl=mySprite
|
|
292
|
-
//% frames.defl=Fire Plane Right
|
|
293
|
-
//% sprite.shadow=variables_get
|
|
294
|
-
//% frames.shadow=animation_editor
|
|
295
|
-
//% frameInterval.shadow=timePicker
|
|
296
|
-
//% rule.shadow=arcade_character_make_rule
|
|
297
|
-
//% weight=100
|
|
298
|
-
//% blockGap=8
|
|
299
|
-
//% help=github:arcade-character-animations/docs/loop-character-animation
|
|
300
|
-
export function loopFrames2(sprite: Sprite, frames: Image[], frameInterval: number, rule: number) {
|
|
301
|
-
characterAnimations.loopFrames(sprite, frames, frameInterval, rule);
|
|
302
|
-
}
|
|
303
|
-
}
|
|
242
|
+
```package
|
|
243
|
+
pxt-forest-special=github:kiki-lee/forest-special/
|
|
304
244
|
```
|
|
305
245
|
|
|
306
246
|
|
|
@@ -233,24 +233,11 @@ keep moving through the skillmap so you can see how to make your fires spread.
|
|
|
233
233
|
|
|
234
234
|
|
|
235
235
|
|
|
236
|
-
|
|
237
236
|
```package
|
|
238
|
-
pxt-
|
|
239
|
-
pxt-text=github:microsoft/arcade-text
|
|
240
|
-
arcade-premium-life=github:jwunderl/arcade-premium-life/
|
|
241
|
-
pxt-characterAnimations=github:microsoft/arcade-character-animations/
|
|
242
|
-
pxt-data=github:microsoft/arcade-sprite-data/
|
|
243
|
-
pxt-story=github:microsoft/arcade-storytelling/
|
|
244
|
-
arcade-sprite-util=github:jwunderl/arcade-sprite-util/
|
|
245
|
-
pxt-status-bar=github:jwunderl/pxt-status-bar
|
|
237
|
+
pxt-forest-special=github:kiki-lee/forest-special/
|
|
246
238
|
```
|
|
247
239
|
|
|
248
240
|
```template
|
|
249
|
-
namespace SpriteKind {
|
|
250
|
-
export const Water = SpriteKind.create()
|
|
251
|
-
export const Fire = SpriteKind.create()
|
|
252
|
-
export const Burnt = SpriteKind.create()
|
|
253
|
-
}
|
|
254
241
|
|
|
255
242
|
tiles.setTilemap(tilemap`level1`)
|
|
256
243
|
let mySprite = sprites.create(assets.image`Fire Plane Right`, SpriteKind.Player)
|
|
@@ -271,166 +258,6 @@ sprites.onCreated(SpriteKind.Fire, function (sprite) {
|
|
|
271
258
|
|
|
272
259
|
|
|
273
260
|
|
|
274
|
-
```customts
|
|
275
|
-
|
|
276
|
-
|
|
277
|
-
let spreadOptions: number[] = []
|
|
278
|
-
|
|
279
|
-
let windSpeed = 5
|
|
280
|
-
let tinder = 4
|
|
281
|
-
let dryGrass = 5
|
|
282
|
-
let spreadTimeBase = 2000
|
|
283
|
-
let hoseDirection = 270
|
|
284
|
-
let facing = 0
|
|
285
|
-
let changeRate = 7
|
|
286
|
-
|
|
287
|
-
let statusbar = statusbars.create(82, 4, StatusBarKind.Health)
|
|
288
|
-
statusbar.top = 12
|
|
289
|
-
statusbar.left = 4
|
|
290
|
-
statusbar.max = tiles.tilemapRows() * tiles.tilemapColumns()
|
|
291
|
-
statusbar.value = tiles.tilemapRows() * tiles.tilemapColumns()
|
|
292
|
-
|
|
293
|
-
let statusLabel = textsprite.create("Healthy Forest", 0, 1)
|
|
294
|
-
statusLabel.setFlag(SpriteFlag.RelativeToCamera, true)
|
|
295
|
-
statusLabel.top = 2
|
|
296
|
-
statusLabel.left = 4
|
|
297
|
-
statusbar.setColor(7, 14)
|
|
298
|
-
let fireLabel = textsprite.create("Fires:")
|
|
299
|
-
fireLabel.right = 145
|
|
300
|
-
fireLabel.top = 2
|
|
301
|
-
fireLabel.setMaxFontHeight(4)
|
|
302
|
-
fireLabel.setFlag(SpriteFlag.RelativeToCamera, true)
|
|
303
|
-
statusLabel.setFlag(SpriteFlag.Invisible, true)
|
|
304
|
-
statusbar.setFlag(SpriteFlag.Invisible, true)
|
|
305
|
-
fireLabel.setFlag(SpriteFlag.Invisible, true)
|
|
306
|
-
info.showScore(false)
|
|
307
|
-
|
|
308
|
-
game.onUpdate(function () {
|
|
309
|
-
spreadTimeBase = 4500 - (250 * windSpeed + 250 * dryGrass - 100 * tinder)
|
|
310
|
-
})
|
|
311
|
-
|
|
312
|
-
|
|
313
|
-
|
|
314
|
-
|
|
315
|
-
namespace animation {
|
|
316
|
-
/*
|
|
317
|
-
* Loops the passed frames on the sprite at the given interval whenever
|
|
318
|
-
* the specified rule is true for that sprite.
|
|
319
|
-
*
|
|
320
|
-
* If more than one rule applies, the most specific rule will be used.
|
|
321
|
-
* If multiple rules are equally specific, the currently executing rule
|
|
322
|
-
* is favored (or one is chosen at random).
|
|
323
|
-
*
|
|
324
|
-
* @param sprite the sprite to animate
|
|
325
|
-
* @param frames the images that make up that animation
|
|
326
|
-
* @param frame Interval the amount of time to spend on each frame in milliseconds
|
|
327
|
-
* @param rule the rule that decides when this animation will play
|
|
328
|
-
*/
|
|
329
|
-
//% blockId=arcade_character_loop_frames2
|
|
330
|
-
//% block="animate $sprite loop frames $frames interval (ms) $frameInterval when $rule"
|
|
331
|
-
//% sprite.defl=mySprite
|
|
332
|
-
//% frames.defl=Fire Plane Right
|
|
333
|
-
//% sprite.shadow=variables_get
|
|
334
|
-
//% frames.shadow=animation_editor
|
|
335
|
-
//% frameInterval.shadow=timePicker
|
|
336
|
-
//% rule.shadow=arcade_character_make_rule
|
|
337
|
-
//% weight=100
|
|
338
|
-
//% blockGap=8
|
|
339
|
-
//% help=github:arcade-character-animations/docs/loop-character-animation
|
|
340
|
-
export function loopFrames2(sprite: Sprite, frames: Image[], frameInterval: number, rule: number) {
|
|
341
|
-
characterAnimations.loopFrames(sprite, frames, frameInterval, rule);
|
|
342
|
-
}
|
|
343
|
-
}
|
|
344
|
-
|
|
345
|
-
|
|
346
|
-
namespace sprites {
|
|
347
|
-
/*
|
|
348
|
-
* Set how many "lives" a sprite has
|
|
349
|
-
*/
|
|
350
|
-
//% block="set strength of $thisSprite=variables_get(mySprite) to $num"
|
|
351
|
-
//% num.defl=10
|
|
352
|
-
export function set_flame_strength (thisSprite: Sprite, num: number) {
|
|
353
|
-
sprites.setDataNumber(thisSprite, "life", num)
|
|
354
|
-
sprites.setDataNumber(thisSprite, "spreadTime", spreadTimeBase + 1000)
|
|
355
|
-
}
|
|
356
|
-
|
|
357
|
-
|
|
358
|
-
/*
|
|
359
|
-
* Add or subtract "lives" from a sprite
|
|
360
|
-
*/
|
|
361
|
-
//% block="change strength of $thisSprite=variables_get(mySprite) by $num"
|
|
362
|
-
//% num.defl=-1
|
|
363
|
-
export function change_flame_strength_by (thisSprite: Sprite, num: number) {
|
|
364
|
-
sprites.changeDataNumberBy(thisSprite, "life", num)
|
|
365
|
-
for (let value of sprites.allOfKind(SpriteKind.Fire)) {
|
|
366
|
-
if (sprites.readDataNumber(value, "life") <= 0) {
|
|
367
|
-
effects.clearParticles(value)
|
|
368
|
-
value.destroy()
|
|
369
|
-
}
|
|
370
|
-
}
|
|
371
|
-
}
|
|
372
|
-
|
|
373
|
-
/*
|
|
374
|
-
* Choose a sprite to "spray" an image (in sprite form.)
|
|
375
|
-
*/
|
|
376
|
-
//% block="spray from $thisSprite=variables_get(mySprite) using $img=screen_image_picker"
|
|
377
|
-
//% img.defl=water
|
|
378
|
-
export function spray (thisSprite: Sprite, img: Image) {
|
|
379
|
-
|
|
380
|
-
if (controller.up.isPressed()) {
|
|
381
|
-
if (controller.left.isPressed()) {
|
|
382
|
-
facing = 225
|
|
383
|
-
} else if (controller.right.isPressed()) {
|
|
384
|
-
facing = 315
|
|
385
|
-
} else if (controller.down.isPressed()) {
|
|
386
|
-
|
|
387
|
-
} else {
|
|
388
|
-
facing = 270
|
|
389
|
-
}
|
|
390
|
-
} else if (controller.left.isPressed()) {
|
|
391
|
-
if (controller.right.isPressed()) {
|
|
392
|
-
|
|
393
|
-
} else if (controller.down.isPressed()) {
|
|
394
|
-
facing = 135
|
|
395
|
-
} else {
|
|
396
|
-
facing = 180
|
|
397
|
-
}
|
|
398
|
-
} else if (controller.right.isPressed()) {
|
|
399
|
-
if (controller.down.isPressed()) {
|
|
400
|
-
facing = 45
|
|
401
|
-
} else {
|
|
402
|
-
facing = 0
|
|
403
|
-
}
|
|
404
|
-
} else if (controller.down.isPressed()) {
|
|
405
|
-
facing = 90
|
|
406
|
-
}
|
|
407
|
-
|
|
408
|
-
if (Math.abs(facing - hoseDirection) < 180) {
|
|
409
|
-
if (facing < hoseDirection) {
|
|
410
|
-
hoseDirection += 0 - changeRate
|
|
411
|
-
} else {
|
|
412
|
-
hoseDirection += changeRate
|
|
413
|
-
}
|
|
414
|
-
} else{
|
|
415
|
-
if (facing < hoseDirection) {
|
|
416
|
-
hoseDirection += changeRate
|
|
417
|
-
} else {
|
|
418
|
-
hoseDirection += 0 - changeRate
|
|
419
|
-
}
|
|
420
|
-
if (hoseDirection < 0) {
|
|
421
|
-
hoseDirection += 360
|
|
422
|
-
} else if (hoseDirection > 360) {
|
|
423
|
-
hoseDirection += -360
|
|
424
|
-
}
|
|
425
|
-
hoseDirection = hoseDirection % 360
|
|
426
|
-
}
|
|
427
|
-
let waterProj = sprites.createProjectileFromSprite(img, thisSprite, 150 * Math.cos(spriteutils.degreesToRadians(hoseDirection)), 150 * Math.sin(spriteutils.degreesToRadians(hoseDirection)))
|
|
428
|
-
waterProj.setKind(SpriteKind.Water)
|
|
429
|
-
}
|
|
430
|
-
}
|
|
431
|
-
```
|
|
432
|
-
|
|
433
|
-
|
|
434
261
|
```assetjson
|
|
435
262
|
{
|
|
436
263
|
"README.md": " ",
|
|
@@ -308,7 +308,7 @@ When the fire overlaps another flame, we can destroy one of the flames.
|
|
|
308
308
|
``||sprites:on [sprite] of kind [Player] overlaps [otherSprite] of kind [Player]||``
|
|
309
309
|
container into an empty area of the workspace.
|
|
310
310
|
|
|
311
|
-
- :mouse pointer: Change both sprite kinds to ``||
|
|
311
|
+
- :mouse pointer: Change both sprite kinds to ``||sprites:Fire||``.
|
|
312
312
|
|
|
313
313
|
|
|
314
314
|
|
|
@@ -378,25 +378,12 @@ keep moving through the skillmap to find out how to add a heads-up display to yo
|
|
|
378
378
|
|
|
379
379
|
|
|
380
380
|
|
|
381
|
-
|
|
382
381
|
```package
|
|
383
|
-
pxt-
|
|
384
|
-
pxt-text=github:microsoft/arcade-text
|
|
385
|
-
arcade-premium-life=github:jwunderl/arcade-premium-life/
|
|
386
|
-
pxt-characterAnimations=github:microsoft/arcade-character-animations/
|
|
387
|
-
pxt-data=github:microsoft/arcade-sprite-data/
|
|
388
|
-
pxt-story=github:microsoft/arcade-storytelling/
|
|
389
|
-
arcade-sprite-util=github:jwunderl/arcade-sprite-util/
|
|
390
|
-
pxt-status-bar=github:jwunderl/pxt-status-bar
|
|
382
|
+
pxt-forest-special=github:kiki-lee/forest-special/
|
|
391
383
|
```
|
|
392
384
|
|
|
393
385
|
|
|
394
386
|
```template
|
|
395
|
-
namespace SpriteKind {
|
|
396
|
-
export const Water = SpriteKind.create()
|
|
397
|
-
export const Fire = SpriteKind.create()
|
|
398
|
-
export const Burnt = SpriteKind.create()
|
|
399
|
-
}
|
|
400
387
|
|
|
401
388
|
controller.A.onEvent(ControllerButtonEvent.Repeated, function () {
|
|
402
389
|
sprites.spray(mySprite, assets.image`water`)
|
|
@@ -424,327 +411,6 @@ sprites.onOverlap(SpriteKind.Water, SpriteKind.Fire, function (sprite, otherSpri
|
|
|
424
411
|
|
|
425
412
|
```
|
|
426
413
|
|
|
427
|
-
|
|
428
|
-
```customts
|
|
429
|
-
|
|
430
|
-
let spreadOptions: number[] = []
|
|
431
|
-
|
|
432
|
-
let windSpeed = 5
|
|
433
|
-
let tinder = 4
|
|
434
|
-
let dryGrass = 5
|
|
435
|
-
let spreadTimeBase = 2000
|
|
436
|
-
let hoseDirection = 270
|
|
437
|
-
let facing = 0
|
|
438
|
-
let changeRate = 7
|
|
439
|
-
let burnedColor = 2
|
|
440
|
-
let healthyColor = 3
|
|
441
|
-
|
|
442
|
-
let statusbar = statusbars.create(82, 4, StatusBarKind.Health)
|
|
443
|
-
statusbar.top = 12
|
|
444
|
-
statusbar.left = 4
|
|
445
|
-
statusbar.max = tiles.tilemapRows() * tiles.tilemapColumns()
|
|
446
|
-
statusbar.value = tiles.tilemapRows() * tiles.tilemapColumns()
|
|
447
|
-
statusbar.setColor(healthyColor, burnedColor)
|
|
448
|
-
let statusLabel = textsprite.create("Healthy Forest", 0, 1)
|
|
449
|
-
statusLabel.setFlag(SpriteFlag.RelativeToCamera, true)
|
|
450
|
-
statusLabel.top = 2
|
|
451
|
-
statusLabel.left = 4
|
|
452
|
-
let fireLabel = textsprite.create("Fires:")
|
|
453
|
-
fireLabel.right = 145
|
|
454
|
-
fireLabel.top = 2
|
|
455
|
-
fireLabel.setMaxFontHeight(4)
|
|
456
|
-
fireLabel.setFlag(SpriteFlag.RelativeToCamera, true)
|
|
457
|
-
statusLabel.setFlag(SpriteFlag.Invisible, true)
|
|
458
|
-
statusbar.setFlag(SpriteFlag.Invisible, true)
|
|
459
|
-
fireLabel.setFlag(SpriteFlag.Invisible, true)
|
|
460
|
-
info.showScore(false)
|
|
461
|
-
|
|
462
|
-
|
|
463
|
-
|
|
464
|
-
game.onUpdate(function () {
|
|
465
|
-
statusbar.max = tiles.tilemapRows() * tiles.tilemapColumns()
|
|
466
|
-
statusbar.value = tiles.tilemapRows() * tiles.tilemapColumns() - tiles.getTilesByType(assets.tile`burnt tree`).length
|
|
467
|
-
spreadTimeBase = 4500 - (250 * windSpeed + 250 * dryGrass - 100 * tinder)
|
|
468
|
-
if (sprites.allOfKind(SpriteKind.Fire).length <= 0) {
|
|
469
|
-
hud.fire_hud(false)
|
|
470
|
-
info.setScore(statusbar.value / statusbar.max * 100)
|
|
471
|
-
game.splash("You saved " + convertToText(info.score()) + "% of the forest!")
|
|
472
|
-
game.over(true)
|
|
473
|
-
} else {
|
|
474
|
-
info.setScore(sprites.allOfKind(SpriteKind.Fire).length)
|
|
475
|
-
}
|
|
476
|
-
})
|
|
477
|
-
|
|
478
|
-
|
|
479
|
-
|
|
480
|
-
namespace animation {
|
|
481
|
-
/*
|
|
482
|
-
* Loops the passed frames on the sprite at the given interval whenever
|
|
483
|
-
* the specified rule is true for that sprite.
|
|
484
|
-
*
|
|
485
|
-
* If more than one rule applies, the most specific rule will be used.
|
|
486
|
-
* If multiple rules are equally specific, the currently executing rule
|
|
487
|
-
* is favored (or one is chosen at random).
|
|
488
|
-
*
|
|
489
|
-
* @param sprite the sprite to animate
|
|
490
|
-
* @param frames the images that make up that animation
|
|
491
|
-
* @param frame Interval the amount of time to spend on each frame in milliseconds
|
|
492
|
-
* @param rule the rule that decides when this animation will play
|
|
493
|
-
*/
|
|
494
|
-
//% blockId=arcade_character_loop_frames2
|
|
495
|
-
//% block="animate $sprite loop frames $frames interval (ms) $frameInterval when $rule"
|
|
496
|
-
//% sprite.defl=mySprite
|
|
497
|
-
//% frames.defl=Fire Plane Right
|
|
498
|
-
//% sprite.shadow=variables_get
|
|
499
|
-
//% frames.shadow=animation_editor
|
|
500
|
-
//% frameInterval.shadow=timePicker
|
|
501
|
-
//% rule.shadow=arcade_character_make_rule
|
|
502
|
-
//% weight=100
|
|
503
|
-
//% blockGap=8
|
|
504
|
-
//% help=github:arcade-character-animations/docs/loop-character-animation
|
|
505
|
-
export function loopFrames2(sprite: Sprite, frames: Image[], frameInterval: number, rule: number) {
|
|
506
|
-
characterAnimations.loopFrames(sprite, frames, frameInterval, rule);
|
|
507
|
-
}
|
|
508
|
-
}
|
|
509
|
-
|
|
510
|
-
|
|
511
|
-
namespace game {
|
|
512
|
-
|
|
513
|
-
/*
|
|
514
|
-
* Set the strength of your wind.
|
|
515
|
-
* Higher numbers spread fire faster.
|
|
516
|
-
*/
|
|
517
|
-
//% block="set strength of wind to $num"
|
|
518
|
-
//% num.defl=3
|
|
519
|
-
export function set_strength_of_wind (num: number) {
|
|
520
|
-
windSpeed = num
|
|
521
|
-
}
|
|
522
|
-
|
|
523
|
-
/*
|
|
524
|
-
* Set the health of your trees.
|
|
525
|
-
* Lower numbers spread fire faster.
|
|
526
|
-
*/
|
|
527
|
-
//% block="set health of trees to $num"
|
|
528
|
-
//% num.defl=7
|
|
529
|
-
export function set_health_of_trees (num: number) {
|
|
530
|
-
tinder = num
|
|
531
|
-
}
|
|
532
|
-
|
|
533
|
-
/*
|
|
534
|
-
* Set how dry your grass is.
|
|
535
|
-
* Higher numbers spread fire faster.
|
|
536
|
-
*/
|
|
537
|
-
//% block="set dryness of grass to $num"
|
|
538
|
-
//% num.defl=3
|
|
539
|
-
export function set_dryness_of_grass (num: number) {
|
|
540
|
-
dryGrass = num
|
|
541
|
-
}
|
|
542
|
-
}
|
|
543
|
-
|
|
544
|
-
//% color="#09282d" icon="\uf1e5"
|
|
545
|
-
//% block="HUD"
|
|
546
|
-
namespace hud {
|
|
547
|
-
|
|
548
|
-
/*
|
|
549
|
-
* Show or hide the current number of burning fires.
|
|
550
|
-
*/
|
|
551
|
-
//% block="show fire HUD $answer"
|
|
552
|
-
//% answer.shadow="toggleYesNo"
|
|
553
|
-
//% answer.defl=true
|
|
554
|
-
export function fire_hud (answer: boolean) {
|
|
555
|
-
|
|
556
|
-
if (answer) {
|
|
557
|
-
fireLabel.setFlag(SpriteFlag.Invisible, false)
|
|
558
|
-
info.showScore(true)
|
|
559
|
-
} else {
|
|
560
|
-
fireLabel.setFlag(SpriteFlag.Invisible, true)
|
|
561
|
-
info.showScore(false)
|
|
562
|
-
}
|
|
563
|
-
|
|
564
|
-
}
|
|
565
|
-
|
|
566
|
-
/*
|
|
567
|
-
* Show or hide how much of the forest has burned.
|
|
568
|
-
*/
|
|
569
|
-
//% block="show forest HUD $answer"
|
|
570
|
-
//% answer.shadow="toggleYesNo"
|
|
571
|
-
//% answer.defl=true
|
|
572
|
-
export function forest_hud (answer: boolean) {
|
|
573
|
-
|
|
574
|
-
if (answer) {
|
|
575
|
-
statusLabel.setFlag(SpriteFlag.Invisible, false)
|
|
576
|
-
statusbar.setFlag(SpriteFlag.Invisible, false)
|
|
577
|
-
|
|
578
|
-
} else {
|
|
579
|
-
statusLabel.setFlag(SpriteFlag.Invisible, true)
|
|
580
|
-
statusbar.setFlag(SpriteFlag.Invisible, true)
|
|
581
|
-
}
|
|
582
|
-
|
|
583
|
-
}
|
|
584
|
-
|
|
585
|
-
|
|
586
|
-
/*
|
|
587
|
-
* Set the color for remaining live forest
|
|
588
|
-
*/
|
|
589
|
-
//% block="set color of healthy forest meter to $color"
|
|
590
|
-
//% color.shadow="colorindexpicker"
|
|
591
|
-
//% color.defl=2
|
|
592
|
-
export function forest_hud_healthy (color: number) {
|
|
593
|
-
healthyColor = color
|
|
594
|
-
statusbar.setColor(healthyColor, burnedColor)
|
|
595
|
-
}
|
|
596
|
-
|
|
597
|
-
/*
|
|
598
|
-
* Set the color for burned forest
|
|
599
|
-
*/
|
|
600
|
-
//% block="set color of burned forest meter to $color"
|
|
601
|
-
//% color.shadow="colorindexpicker"
|
|
602
|
-
//% color.defl=3
|
|
603
|
-
export function forest_hud_burned (color: number) {
|
|
604
|
-
burnedColor = color
|
|
605
|
-
statusbar.setColor(healthyColor, burnedColor)
|
|
606
|
-
}
|
|
607
|
-
|
|
608
|
-
/*
|
|
609
|
-
* Set the label for the forest HUD
|
|
610
|
-
*/
|
|
611
|
-
//% block="set forest HUD label to $name"
|
|
612
|
-
//% name.defl="Healthy Forest"
|
|
613
|
-
export function forest_hud_label (name: string) {
|
|
614
|
-
statusLabel.setText(name)
|
|
615
|
-
}
|
|
616
|
-
|
|
617
|
-
|
|
618
|
-
/*
|
|
619
|
-
* Set the label for the fire-counting HUD
|
|
620
|
-
*/
|
|
621
|
-
//% block="set fire HUD label to $name"
|
|
622
|
-
//% name.defl="Fires:"
|
|
623
|
-
export function fire_hud_label (name: string) {
|
|
624
|
-
fireLabel.setText(name)
|
|
625
|
-
}
|
|
626
|
-
|
|
627
|
-
|
|
628
|
-
}
|
|
629
|
-
|
|
630
|
-
namespace sprites {
|
|
631
|
-
|
|
632
|
-
/*
|
|
633
|
-
* Set the number of "lives" for your sprite.
|
|
634
|
-
*/
|
|
635
|
-
//% block="set strength of $thisSprite=variables_get(mySprite) to $num"
|
|
636
|
-
//% num.defl=10
|
|
637
|
-
export function set_flame_strength (thisSprite: Sprite, num: number) {
|
|
638
|
-
sprites.setDataNumber(thisSprite, "life", num)
|
|
639
|
-
sprites.setDataNumber(thisSprite, "spreadTime", spreadTimeBase + 1000)
|
|
640
|
-
}
|
|
641
|
-
|
|
642
|
-
/*
|
|
643
|
-
* Add or remove "lives" from your sprite.
|
|
644
|
-
*/
|
|
645
|
-
//% block="change strength of $thisSprite=variables_get(mySprite) by $num"
|
|
646
|
-
//% num.defl=-1
|
|
647
|
-
export function change_flame_strength_by (thisSprite: Sprite, num: number) {
|
|
648
|
-
sprites.changeDataNumberBy(thisSprite, "life", num)
|
|
649
|
-
for (let value of sprites.allOfKind(SpriteKind.Fire)) {
|
|
650
|
-
if (sprites.readDataNumber(value, "life") <= 0) {
|
|
651
|
-
effects.clearParticles(value)
|
|
652
|
-
value.destroy()
|
|
653
|
-
}
|
|
654
|
-
}
|
|
655
|
-
}
|
|
656
|
-
|
|
657
|
-
/*
|
|
658
|
-
* Choose a sprite to "spray" an image (in sprite form.)
|
|
659
|
-
*/
|
|
660
|
-
//% block="spray from $thisSprite=variables_get(mySprite) using $img=screen_image_picker"
|
|
661
|
-
//% img.defl=water
|
|
662
|
-
export function spray (thisSprite: Sprite, img: Image) {
|
|
663
|
-
|
|
664
|
-
if (controller.up.isPressed()) {
|
|
665
|
-
if (controller.left.isPressed()) {
|
|
666
|
-
facing = 225
|
|
667
|
-
} else if (controller.right.isPressed()) {
|
|
668
|
-
facing = 315
|
|
669
|
-
} else if (controller.down.isPressed()) {
|
|
670
|
-
|
|
671
|
-
} else {
|
|
672
|
-
facing = 270
|
|
673
|
-
}
|
|
674
|
-
} else if (controller.left.isPressed()) {
|
|
675
|
-
if (controller.right.isPressed()) {
|
|
676
|
-
|
|
677
|
-
} else if (controller.down.isPressed()) {
|
|
678
|
-
facing = 135
|
|
679
|
-
} else {
|
|
680
|
-
facing = 180
|
|
681
|
-
}
|
|
682
|
-
} else if (controller.right.isPressed()) {
|
|
683
|
-
if (controller.down.isPressed()) {
|
|
684
|
-
facing = 45
|
|
685
|
-
} else {
|
|
686
|
-
facing = 0
|
|
687
|
-
}
|
|
688
|
-
} else if (controller.down.isPressed()) {
|
|
689
|
-
facing = 90
|
|
690
|
-
}
|
|
691
|
-
|
|
692
|
-
if (Math.abs(facing - hoseDirection) < 180) {
|
|
693
|
-
if (facing < hoseDirection) {
|
|
694
|
-
hoseDirection += 0 - changeRate
|
|
695
|
-
} else {
|
|
696
|
-
hoseDirection += changeRate
|
|
697
|
-
}
|
|
698
|
-
} else{
|
|
699
|
-
if (facing < hoseDirection) {
|
|
700
|
-
hoseDirection += changeRate
|
|
701
|
-
} else {
|
|
702
|
-
hoseDirection += 0 - changeRate
|
|
703
|
-
}
|
|
704
|
-
if (hoseDirection < 0) {
|
|
705
|
-
hoseDirection += 360
|
|
706
|
-
} else if (hoseDirection > 360) {
|
|
707
|
-
hoseDirection += -360
|
|
708
|
-
}
|
|
709
|
-
hoseDirection = hoseDirection % 360
|
|
710
|
-
}
|
|
711
|
-
let waterProj = sprites.createProjectileFromSprite(img, thisSprite, 150 * Math.cos(spriteutils.degreesToRadians(hoseDirection)), 150 * Math.sin(spriteutils.degreesToRadians(hoseDirection)))
|
|
712
|
-
waterProj.setKind(SpriteKind.Water)
|
|
713
|
-
}
|
|
714
|
-
|
|
715
|
-
/*
|
|
716
|
-
* Spread current fires according to wind speed,
|
|
717
|
-
* dryness of grass, and health of trees.
|
|
718
|
-
*/
|
|
719
|
-
//% block="random spread $myImage=screen_image_picker"
|
|
720
|
-
export function random_spread (myImage: Image) {
|
|
721
|
-
|
|
722
|
-
for (let value of sprites.allOfKind(SpriteKind.Fire)) {
|
|
723
|
-
if (sprites.readDataNumber(value, "life") <= 0) {
|
|
724
|
-
effects.clearParticles(value)
|
|
725
|
-
value.destroy()
|
|
726
|
-
}
|
|
727
|
-
|
|
728
|
-
let list2 = [-32,-16,0,16,32,16,-16]
|
|
729
|
-
if (game.runtime() > sprites.readDataNumber(value, "spreadTime")) {
|
|
730
|
-
sprites.setDataNumber(value, "spreadTime", game.runtime() + randint(spreadTimeBase, spreadTimeBase + 1000))
|
|
731
|
-
let newFire = sprites.create(myImage, SpriteKind.Fire)
|
|
732
|
-
newFire.setPosition(value.x + list2._pickRandom(), value.y)
|
|
733
|
-
sprites.setDataNumber(newFire, "spreadTime", game.runtime() + randint(spreadTimeBase, spreadTimeBase + 1000))
|
|
734
|
-
if (Math.percentChance(50)) {
|
|
735
|
-
newFire.y += list2._pickRandom()
|
|
736
|
-
}
|
|
737
|
-
if (tiles.tileIsWall(tiles.locationOfSprite(newFire))) {
|
|
738
|
-
newFire.setPosition(value.x, value.y)
|
|
739
|
-
}
|
|
740
|
-
}
|
|
741
|
-
}
|
|
742
|
-
}
|
|
743
|
-
|
|
744
|
-
}
|
|
745
|
-
```
|
|
746
|
-
|
|
747
|
-
|
|
748
414
|
```assetjson
|
|
749
415
|
{
|
|
750
416
|
"README.md": " ",
|