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
|
@@ -0,0 +1,179 @@
|
|
|
1
|
+
# Hit the Wall
|
|
2
|
+
|
|
3
|
+
|
|
4
|
+
## Welcome @showdialog
|
|
5
|
+
|
|
6
|
+
Add welcome text here.
|
|
7
|
+
|
|
8
|
+
|
|
9
|
+
|
|
10
|
+
|
|
11
|
+
|
|
12
|
+
## 2.
|
|
13
|
+
|
|
14
|
+
text
|
|
15
|
+
|
|
16
|
+
|
|
17
|
+
|
|
18
|
+
|
|
19
|
+
|
|
20
|
+
```template
|
|
21
|
+
|
|
22
|
+
|
|
23
|
+
|
|
24
|
+
sprites.onOverlap(SpriteKind.Ball, SpriteKind.RightPaddle, function (sprite, otherSprite) {
|
|
25
|
+
sprites.bounce(sprite)
|
|
26
|
+
info.player2.changeScoreBy(1)
|
|
27
|
+
})
|
|
28
|
+
sprites.onOverlap(SpriteKind.Ball, SpriteKind.WallRight, function (sprite, otherSprite) {
|
|
29
|
+
otherSprite.destroy()
|
|
30
|
+
info.player1.changeScoreBy(1)
|
|
31
|
+
})
|
|
32
|
+
sprites.onOverlap(SpriteKind.Ball, SpriteKind.LeftPaddle, function (sprite, otherSprite) {
|
|
33
|
+
sprites.bounce(sprite)
|
|
34
|
+
info.player1.changeScoreBy(1)
|
|
35
|
+
})
|
|
36
|
+
sprites.onOverlap(SpriteKind.Ball, SpriteKind.WallLeft, function (sprite, otherSprite) {
|
|
37
|
+
otherSprite.destroy()
|
|
38
|
+
info.player2.changeScoreBy(1)
|
|
39
|
+
})
|
|
40
|
+
|
|
41
|
+
let wall: Sprite = null
|
|
42
|
+
let ball = sprites.create(assets.image`ball`, SpriteKind.Ball)
|
|
43
|
+
ball.setVelocity(100, 100)
|
|
44
|
+
ball.setBounceOnWall(true)
|
|
45
|
+
let left_paddle = sprites.create(assets.image`left paddle`, SpriteKind.LeftPaddle)
|
|
46
|
+
left_paddle.left = 0
|
|
47
|
+
left_paddle.setStayInScreen(true)
|
|
48
|
+
controller.player1.moveSprite(left_paddle, 0, 150)
|
|
49
|
+
info.player1.setScore(0)
|
|
50
|
+
let right_paddle = sprites.create(assets.image`right paddle`, SpriteKind.RightPaddle)
|
|
51
|
+
right_paddle.right = 160
|
|
52
|
+
right_paddle.setStayInScreen(true)
|
|
53
|
+
controller.player2.moveSprite(right_paddle, 0, 150)
|
|
54
|
+
info.player2.setScore(0)
|
|
55
|
+
|
|
56
|
+
for (let index = 0; index <= 9; index++) {
|
|
57
|
+
wall = sprites.create(assets.image`wall`, SpriteKind.WallLeft)
|
|
58
|
+
wall.z = -5000
|
|
59
|
+
wall.top = index * 12
|
|
60
|
+
wall.left = 0
|
|
61
|
+
}
|
|
62
|
+
for (let index = 0; index <= 9; index++) {
|
|
63
|
+
wall = sprites.create(assets.image`wall`, SpriteKind.WallRight)
|
|
64
|
+
wall.z = -5000
|
|
65
|
+
wall.top = index * 12
|
|
66
|
+
wall.right = 160
|
|
67
|
+
}
|
|
68
|
+
|
|
69
|
+
|
|
70
|
+
game.onUpdate(function () {
|
|
71
|
+
logic.checkForWinner(sprites.spritesOfKindGone(SpriteKind.WallLeft) || sprites.spritesOfKindGone(SpriteKind.WallRight))
|
|
72
|
+
})
|
|
73
|
+
```
|
|
74
|
+
|
|
75
|
+
|
|
76
|
+
|
|
77
|
+
```customts
|
|
78
|
+
|
|
79
|
+
namespace SpriteKind {
|
|
80
|
+
|
|
81
|
+
//% isKind
|
|
82
|
+
export const LeftPaddle = SpriteKind.create()
|
|
83
|
+
|
|
84
|
+
//% isKind
|
|
85
|
+
export const RightPaddle = SpriteKind.create()
|
|
86
|
+
|
|
87
|
+
//% isKind
|
|
88
|
+
export const Ball = SpriteKind.create()
|
|
89
|
+
|
|
90
|
+
//% isKind
|
|
91
|
+
export const Wall = SpriteKind.create()
|
|
92
|
+
|
|
93
|
+
//% isKind
|
|
94
|
+
export const WallRight = SpriteKind.create()
|
|
95
|
+
|
|
96
|
+
//% isKind
|
|
97
|
+
export const WallLeft = SpriteKind.create()
|
|
98
|
+
}
|
|
99
|
+
|
|
100
|
+
|
|
101
|
+
|
|
102
|
+
namespace sprites {
|
|
103
|
+
|
|
104
|
+
|
|
105
|
+
/**
|
|
106
|
+
* Returns true if all of kind is gone
|
|
107
|
+
*/
|
|
108
|
+
//% block="all sprites of kind $thisSpriteKind destroyed"
|
|
109
|
+
//% thisSpriteKind.shadow=spritekind
|
|
110
|
+
export function spritesOfKindGone(thisSpriteKind:number): boolean {
|
|
111
|
+
return (sprites.allOfKind(thisSpriteKind).length == 0)
|
|
112
|
+
}
|
|
113
|
+
|
|
114
|
+
/**
|
|
115
|
+
* Sends sprite in direction of inverse from that point
|
|
116
|
+
*/
|
|
117
|
+
//% block="bounce $thisSprite=variables_get(mySprite)"
|
|
118
|
+
export function bounce (thisSprite: Sprite) {
|
|
119
|
+
if (thisSprite.vx <= 0) {
|
|
120
|
+
thisSprite.x = thisSprite.x + 5
|
|
121
|
+
} else {
|
|
122
|
+
thisSprite.x = thisSprite.x - 5
|
|
123
|
+
}
|
|
124
|
+
thisSprite.vx = thisSprite.vx * -1
|
|
125
|
+
}
|
|
126
|
+
|
|
127
|
+
/**
|
|
128
|
+
* Returns the number of remaining sprites of a kind
|
|
129
|
+
*/
|
|
130
|
+
//% block="number of sprites of kind $thisSpriteKind"
|
|
131
|
+
//% thisSpriteKind.shadow=spritekind
|
|
132
|
+
export function spritesOfKind(thisSpriteKind:number): number {
|
|
133
|
+
return (sprites.allOfKind(thisSpriteKind).length)
|
|
134
|
+
}
|
|
135
|
+
|
|
136
|
+
|
|
137
|
+
}
|
|
138
|
+
|
|
139
|
+
|
|
140
|
+
|
|
141
|
+
namespace logic {
|
|
142
|
+
|
|
143
|
+
//% block="end game if $thisBool"
|
|
144
|
+
//% thisBool.defl= false
|
|
145
|
+
export function checkForWinner (thisBool: boolean) {
|
|
146
|
+
if (thisBool) {
|
|
147
|
+
|
|
148
|
+
let winner = ""
|
|
149
|
+
if (info.player1.score() == info.player2.score()) {
|
|
150
|
+
winner = "The game was a tie!"
|
|
151
|
+
} else if (info.player1.score() > info.player2.score()) {
|
|
152
|
+
winner = "Player 1 Wins!"
|
|
153
|
+
} else {
|
|
154
|
+
winner = "Player 2 Wins!"
|
|
155
|
+
}
|
|
156
|
+
game.splash("Game Over!", winner)
|
|
157
|
+
effects.confetti.startScreenEffect(500)
|
|
158
|
+
game.reset()
|
|
159
|
+
}
|
|
160
|
+
}
|
|
161
|
+
}
|
|
162
|
+
|
|
163
|
+
|
|
164
|
+
```
|
|
165
|
+
|
|
166
|
+
|
|
167
|
+
```assetjson
|
|
168
|
+
{
|
|
169
|
+
"README.md": " ",
|
|
170
|
+
"assets.json": "",
|
|
171
|
+
"images.g.jres": "{\n \"image4\": {\n \"data\": \"hwQBAAwAAAAREREREREAAA==\",\n \"mimeType\": \"image/x-mkcd-f4\",\n \"displayName\": \"wall\"\n },\n \"image1\": {\n \"data\": \"hwQNAA0AAAAAYGZmAAAAAABm3W0GAAAAYNbd3W0AAABg3d3dbQAAAGbd3d1tBgAA1hHR3W0GAAARGRHRbQEAABGZEREdAQAAEJEZEREAAAAQEZkREQAAAAAREREBAAAAABAREQAAAAAAAAAAAAAAAA==\",\n \"mimeType\": \"image/x-mkcd-f4\",\n \"displayName\": \"ball\"\n },\n \"image2\": {\n \"data\": \"hwQEABgAAAB3d3d3d3d3d3d3d3d3d3d3d3d3d3d3d3d3d3d3d3d3d3d3d3d3d3d3d3d3d3d3d3c=\",\n \"mimeType\": \"image/x-mkcd-f4\",\n \"displayName\": \"left paddle\"\n },\n \"image3\": {\n \"data\": \"hwQEABgAAABVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVU=\",\n \"mimeType\": \"image/x-mkcd-f4\",\n \"displayName\": \"right paddle\"\n },\n \"*\": {\n \"mimeType\": \"image/x-mkcd-f4\",\n \"dataEncoding\": \"base64\",\n \"namespace\": \"myImages\"\n }\n}",
|
|
172
|
+
"images.g.ts": "// Auto-generated code. Do not edit.\nnamespace myImages {\n\n helpers._registerFactory(\"image\", function(name: string) {\n switch(helpers.stringTrim(name)) {\n case \"image4\":\n case \"wall\":return img`\n1 \n1 \n1 \n1 \n1 \n1 \n1 \n1 \n1 \n1 \n1 \n1 \n`;\n case \"image1\":\n case \"ball\":return img`\n. . . . 6 6 1 1 . . . . . \n. . 6 6 6 d 1 1 1 1 . . . \n. 6 6 d d 1 9 9 1 1 1 . . \n6 6 d d d 1 1 9 9 1 1 1 . \n6 d d d d 1 1 1 9 9 1 1 . \n6 d d d d d 1 1 1 9 1 1 . \n6 d d d d d 1 1 1 1 1 1 . \n6 6 d d d d d 1 1 1 1 1 . \n. 6 d d d d d d 1 1 1 . . \n. . 6 6 6 6 6 1 1 1 . . . \n. . . . 6 6 1 1 . . . . . \n. . . . . . . . . . . . . \n. . . . . . . . . . . . . \n`;\n case \"image2\":\n case \"left paddle\":return img`\n7 7 7 7 \n7 7 7 7 \n7 7 7 7 \n7 7 7 7 \n7 7 7 7 \n7 7 7 7 \n7 7 7 7 \n7 7 7 7 \n7 7 7 7 \n7 7 7 7 \n7 7 7 7 \n7 7 7 7 \n7 7 7 7 \n7 7 7 7 \n7 7 7 7 \n7 7 7 7 \n7 7 7 7 \n7 7 7 7 \n7 7 7 7 \n7 7 7 7 \n7 7 7 7 \n7 7 7 7 \n7 7 7 7 \n7 7 7 7 \n`;\n case \"image3\":\n case \"right paddle\":return img`\n5 5 5 5 \n5 5 5 5 \n5 5 5 5 \n5 5 5 5 \n5 5 5 5 \n5 5 5 5 \n5 5 5 5 \n5 5 5 5 \n5 5 5 5 \n5 5 5 5 \n5 5 5 5 \n5 5 5 5 \n5 5 5 5 \n5 5 5 5 \n5 5 5 5 \n5 5 5 5 \n5 5 5 5 \n5 5 5 5 \n5 5 5 5 \n5 5 5 5 \n5 5 5 5 \n5 5 5 5 \n5 5 5 5 \n5 5 5 5 \n`;\n }\n return null;\n })\n\n helpers._registerFactory(\"animation\", function(name: string) {\n switch(helpers.stringTrim(name)) {\n\n }\n return null;\n })\n\n}\n// Auto-generated code. Do not edit.\n",
|
|
173
|
+
"main.blocks": "<xml xmlns=\"https://developers.google.com/blockly/xml\"><variables><variable type=\"KIND_SpriteKind\" id=\"GY;xh:3E#-Q0`bQXH-=K\">Player</variable><variable type=\"KIND_SpriteKind\" id=\"%](8L+$)iLXB(gr[q1VP\">Projectile</variable><variable type=\"KIND_SpriteKind\" id=\"Z-!A#A{tscDOH2FpV`BK\">Food</variable><variable type=\"KIND_SpriteKind\" id=\"@Cjqk^j=14Avc:Ldh@K4\">Enemy</variable><variable type=\"KIND_SpriteKind\" id=\"7R;Ys`NElG]Jt0zjz3^y\">LeftPaddle</variable><variable type=\"KIND_SpriteKind\" id=\"4T[mYc_9GH~eMF3;J3Tq\">RightPaddle</variable><variable type=\"KIND_SpriteKind\" id=\"=R=0`*aWGgy)0^6Fpa8i\">Ball</variable><variable type=\"KIND_SpriteKind\" id=\"V!B3aslyF5Nk,:D$xf:]\">Wall</variable><variable type=\"KIND_SpriteKind\" id=\"uL/=NuFX4AF;dXzq3Bu[\">WallRight</variable><variable type=\"KIND_SpriteKind\" id=\"k_pN[XcA0rUgy.f5a)R{\">WallLeft</variable><variable id=\"G;3kgL(o/K%$weq(nrQV\">ball</variable><variable id=\"T(VrroIqq.[9i1Kvx+9z\">left_paddle</variable><variable id=\"o]G/z11#=Tm4x]aYdmWN\">mySprite</variable><variable id=\"X5AbSi:TF@iPJF}p[?66\">right_paddle</variable><variable id=\"Ac!UHWV~7qD56)=U^Fp_\">myEnemy</variable><variable id=\"vH9lY,Bi#O3@m[8dNDf{\">index</variable><variable id=\"jOn=1LQzJzqV*M1v4Z^p\">wall</variable><variable id=\"lz;wc)j+0tf)BtlQt4|w\">list</variable><variable id=\"2F/F@vbT@4#t5BNzjL7)\">winner</variable></variables></xml>",
|
|
174
|
+
"main.ts": "namespace SpriteKind {\n export const LeftPaddle = SpriteKind.create()\n export const RightPaddle = SpriteKind.create()\n export const Ball = SpriteKind.create()\n export const Wall = SpriteKind.create()\n export const WallRight = SpriteKind.create()\n export const WallLeft = SpriteKind.create()\n}\n",
|
|
175
|
+
"pxt.json": "{\n \"name\": \"pongo - assets only\",\n \"description\": \"\",\n \"dependencies\": {\n \"device\": \"*\"\n },\n \"files\": [\n \"main.blocks\",\n \"main.ts\",\n \"README.md\",\n \"assets.json\",\n \"images.g.jres\",\n \"images.g.ts\",\n \"tilemap.g.jres\",\n \"tilemap.g.ts\"\n ],\n \"targetVersions\": {\n \"branch\": \"v1.6.24\",\n \"tag\": \"v1.6.24\",\n \"commits\": \"https://github.com/microsoft/pxt-arcade/commits/5bea1575ea693e0648a647cbd86cda9776d58f48\",\n \"target\": \"1.6.24\",\n \"pxt\": \"7.2.25\"\n },\n \"preferredEditor\": \"blocksprj\"\n}\n",
|
|
176
|
+
"tilemap.g.jres": "{\n \"transparency16\": {\n \"data\": \"hwQQABAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA==\",\n \"mimeType\": \"image/x-mkcd-f4\",\n \"tilemapTile\": true\n },\n \"*\": {\n \"mimeType\": \"image/x-mkcd-f4\",\n \"dataEncoding\": \"base64\",\n \"namespace\": \"myTiles\"\n }\n}",
|
|
177
|
+
"tilemap.g.ts": "// Auto-generated code. Do not edit.\nnamespace myTiles {\n //% fixedInstance jres blockIdentity=images._tile\n export const transparency16 = image.ofBuffer(hex``);\n\n helpers._registerFactory(\"tile\", function(name: string) {\n switch(helpers.stringTrim(name)) {\n case \"transparency16\":return transparency16;\n }\n return null;\n })\n\n}\n// Auto-generated code. Do not edit.\n"
|
|
178
|
+
}
|
|
179
|
+
```
|
|
@@ -0,0 +1,177 @@
|
|
|
1
|
+
# Multiplayer
|
|
2
|
+
|
|
3
|
+
|
|
4
|
+
## Welcome @showdialog
|
|
5
|
+
|
|
6
|
+
Add welcome text here.
|
|
7
|
+
|
|
8
|
+
|
|
9
|
+
|
|
10
|
+
|
|
11
|
+
|
|
12
|
+
## 2.
|
|
13
|
+
|
|
14
|
+
text
|
|
15
|
+
|
|
16
|
+
|
|
17
|
+
|
|
18
|
+
```template
|
|
19
|
+
|
|
20
|
+
|
|
21
|
+
|
|
22
|
+
sprites.onOverlap(SpriteKind.Ball, SpriteKind.RightPaddle, function (sprite, otherSprite) {
|
|
23
|
+
sprites.bounce(sprite)
|
|
24
|
+
info.player2.changeScoreBy(1)
|
|
25
|
+
})
|
|
26
|
+
sprites.onOverlap(SpriteKind.Ball, SpriteKind.WallRight, function (sprite, otherSprite) {
|
|
27
|
+
otherSprite.destroy()
|
|
28
|
+
info.player1.changeScoreBy(1)
|
|
29
|
+
})
|
|
30
|
+
sprites.onOverlap(SpriteKind.Ball, SpriteKind.LeftPaddle, function (sprite, otherSprite) {
|
|
31
|
+
sprites.bounce(sprite)
|
|
32
|
+
info.player1.changeScoreBy(1)
|
|
33
|
+
})
|
|
34
|
+
sprites.onOverlap(SpriteKind.Ball, SpriteKind.WallLeft, function (sprite, otherSprite) {
|
|
35
|
+
otherSprite.destroy()
|
|
36
|
+
info.player2.changeScoreBy(1)
|
|
37
|
+
})
|
|
38
|
+
|
|
39
|
+
let wall: Sprite = null
|
|
40
|
+
let ball = sprites.create(assets.image`ball`, SpriteKind.Ball)
|
|
41
|
+
ball.setVelocity(100, 100)
|
|
42
|
+
ball.setBounceOnWall(true)
|
|
43
|
+
let left_paddle = sprites.create(assets.image`left paddle`, SpriteKind.LeftPaddle)
|
|
44
|
+
left_paddle.left = 0
|
|
45
|
+
left_paddle.setStayInScreen(true)
|
|
46
|
+
controller.player1.moveSprite(left_paddle, 0, 150)
|
|
47
|
+
info.player1.setScore(0)
|
|
48
|
+
let right_paddle = sprites.create(assets.image`right paddle`, SpriteKind.RightPaddle)
|
|
49
|
+
right_paddle.right = 160
|
|
50
|
+
right_paddle.setStayInScreen(true)
|
|
51
|
+
controller.player2.moveSprite(right_paddle, 0, 150)
|
|
52
|
+
info.player2.setScore(0)
|
|
53
|
+
|
|
54
|
+
for (let index = 0; index <= 9; index++) {
|
|
55
|
+
wall = sprites.create(assets.image`wall`, SpriteKind.WallLeft)
|
|
56
|
+
wall.z = -5000
|
|
57
|
+
wall.top = index * 12
|
|
58
|
+
wall.left = 0
|
|
59
|
+
}
|
|
60
|
+
for (let index = 0; index <= 9; index++) {
|
|
61
|
+
wall = sprites.create(assets.image`wall`, SpriteKind.WallRight)
|
|
62
|
+
wall.z = -5000
|
|
63
|
+
wall.top = index * 12
|
|
64
|
+
wall.right = 160
|
|
65
|
+
}
|
|
66
|
+
|
|
67
|
+
|
|
68
|
+
game.onUpdate(function () {
|
|
69
|
+
logic.checkForWinner(sprites.spritesOfKindGone(SpriteKind.WallLeft) || sprites.spritesOfKindGone(SpriteKind.WallRight))
|
|
70
|
+
})
|
|
71
|
+
```
|
|
72
|
+
|
|
73
|
+
|
|
74
|
+
|
|
75
|
+
```customts
|
|
76
|
+
|
|
77
|
+
namespace SpriteKind {
|
|
78
|
+
|
|
79
|
+
//% isKind
|
|
80
|
+
export const LeftPaddle = SpriteKind.create()
|
|
81
|
+
|
|
82
|
+
//% isKind
|
|
83
|
+
export const RightPaddle = SpriteKind.create()
|
|
84
|
+
|
|
85
|
+
//% isKind
|
|
86
|
+
export const Ball = SpriteKind.create()
|
|
87
|
+
|
|
88
|
+
//% isKind
|
|
89
|
+
export const Wall = SpriteKind.create()
|
|
90
|
+
|
|
91
|
+
//% isKind
|
|
92
|
+
export const WallRight = SpriteKind.create()
|
|
93
|
+
|
|
94
|
+
//% isKind
|
|
95
|
+
export const WallLeft = SpriteKind.create()
|
|
96
|
+
}
|
|
97
|
+
|
|
98
|
+
|
|
99
|
+
|
|
100
|
+
namespace sprites {
|
|
101
|
+
|
|
102
|
+
|
|
103
|
+
/**
|
|
104
|
+
* Returns true if all of kind is gone
|
|
105
|
+
*/
|
|
106
|
+
//% block="all sprites of kind $thisSpriteKind destroyed"
|
|
107
|
+
//% thisSpriteKind.shadow=spritekind
|
|
108
|
+
export function spritesOfKindGone(thisSpriteKind:number): boolean {
|
|
109
|
+
return (sprites.allOfKind(thisSpriteKind).length == 0)
|
|
110
|
+
}
|
|
111
|
+
|
|
112
|
+
/**
|
|
113
|
+
* Sends sprite in direction of inverse from that point
|
|
114
|
+
*/
|
|
115
|
+
//% block="bounce $thisSprite=variables_get(mySprite)"
|
|
116
|
+
export function bounce (thisSprite: Sprite) {
|
|
117
|
+
if (thisSprite.vx <= 0) {
|
|
118
|
+
thisSprite.x = thisSprite.x + 5
|
|
119
|
+
} else {
|
|
120
|
+
thisSprite.x = thisSprite.x - 5
|
|
121
|
+
}
|
|
122
|
+
thisSprite.vx = thisSprite.vx * -1
|
|
123
|
+
}
|
|
124
|
+
|
|
125
|
+
/**
|
|
126
|
+
* Returns the number of remaining sprites of a kind
|
|
127
|
+
*/
|
|
128
|
+
//% block="number of sprites of kind $thisSpriteKind"
|
|
129
|
+
//% thisSpriteKind.shadow=spritekind
|
|
130
|
+
export function spritesOfKind(thisSpriteKind:number): number {
|
|
131
|
+
return (sprites.allOfKind(thisSpriteKind).length)
|
|
132
|
+
}
|
|
133
|
+
|
|
134
|
+
|
|
135
|
+
}
|
|
136
|
+
|
|
137
|
+
|
|
138
|
+
|
|
139
|
+
namespace logic {
|
|
140
|
+
|
|
141
|
+
//% block="end game if $thisBool"
|
|
142
|
+
//% thisBool.defl= false
|
|
143
|
+
export function checkForWinner (thisBool: boolean) {
|
|
144
|
+
if (thisBool) {
|
|
145
|
+
|
|
146
|
+
let winner = ""
|
|
147
|
+
if (info.player1.score() == info.player2.score()) {
|
|
148
|
+
winner = "The game was a tie!"
|
|
149
|
+
} else if (info.player1.score() > info.player2.score()) {
|
|
150
|
+
winner = "Player 1 Wins!"
|
|
151
|
+
} else {
|
|
152
|
+
winner = "Player 2 Wins!"
|
|
153
|
+
}
|
|
154
|
+
game.splash("Game Over!", winner)
|
|
155
|
+
effects.confetti.startScreenEffect(500)
|
|
156
|
+
game.reset()
|
|
157
|
+
}
|
|
158
|
+
}
|
|
159
|
+
}
|
|
160
|
+
|
|
161
|
+
|
|
162
|
+
```
|
|
163
|
+
|
|
164
|
+
|
|
165
|
+
```assetjson
|
|
166
|
+
{
|
|
167
|
+
"README.md": " ",
|
|
168
|
+
"assets.json": "",
|
|
169
|
+
"images.g.jres": "{\n \"image4\": {\n \"data\": \"hwQBAAwAAAAREREREREAAA==\",\n \"mimeType\": \"image/x-mkcd-f4\",\n \"displayName\": \"wall\"\n },\n \"image1\": {\n \"data\": \"hwQNAA0AAAAAYGZmAAAAAABm3W0GAAAAYNbd3W0AAABg3d3dbQAAAGbd3d1tBgAA1hHR3W0GAAARGRHRbQEAABGZEREdAQAAEJEZEREAAAAQEZkREQAAAAAREREBAAAAABAREQAAAAAAAAAAAAAAAA==\",\n \"mimeType\": \"image/x-mkcd-f4\",\n \"displayName\": \"ball\"\n },\n \"image2\": {\n \"data\": \"hwQEABgAAAB3d3d3d3d3d3d3d3d3d3d3d3d3d3d3d3d3d3d3d3d3d3d3d3d3d3d3d3d3d3d3d3c=\",\n \"mimeType\": \"image/x-mkcd-f4\",\n \"displayName\": \"left paddle\"\n },\n \"image3\": {\n \"data\": \"hwQEABgAAABVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVU=\",\n \"mimeType\": \"image/x-mkcd-f4\",\n \"displayName\": \"right paddle\"\n },\n \"*\": {\n \"mimeType\": \"image/x-mkcd-f4\",\n \"dataEncoding\": \"base64\",\n \"namespace\": \"myImages\"\n }\n}",
|
|
170
|
+
"images.g.ts": "// Auto-generated code. Do not edit.\nnamespace myImages {\n\n helpers._registerFactory(\"image\", function(name: string) {\n switch(helpers.stringTrim(name)) {\n case \"image4\":\n case \"wall\":return img`\n1 \n1 \n1 \n1 \n1 \n1 \n1 \n1 \n1 \n1 \n1 \n1 \n`;\n case \"image1\":\n case \"ball\":return img`\n. . . . 6 6 1 1 . . . . . \n. . 6 6 6 d 1 1 1 1 . . . \n. 6 6 d d 1 9 9 1 1 1 . . \n6 6 d d d 1 1 9 9 1 1 1 . \n6 d d d d 1 1 1 9 9 1 1 . \n6 d d d d d 1 1 1 9 1 1 . \n6 d d d d d 1 1 1 1 1 1 . \n6 6 d d d d d 1 1 1 1 1 . \n. 6 d d d d d d 1 1 1 . . \n. . 6 6 6 6 6 1 1 1 . . . \n. . . . 6 6 1 1 . . . . . \n. . . . . . . . . . . . . \n. . . . . . . . . . . . . \n`;\n case \"image2\":\n case \"left paddle\":return img`\n7 7 7 7 \n7 7 7 7 \n7 7 7 7 \n7 7 7 7 \n7 7 7 7 \n7 7 7 7 \n7 7 7 7 \n7 7 7 7 \n7 7 7 7 \n7 7 7 7 \n7 7 7 7 \n7 7 7 7 \n7 7 7 7 \n7 7 7 7 \n7 7 7 7 \n7 7 7 7 \n7 7 7 7 \n7 7 7 7 \n7 7 7 7 \n7 7 7 7 \n7 7 7 7 \n7 7 7 7 \n7 7 7 7 \n7 7 7 7 \n`;\n case \"image3\":\n case \"right paddle\":return img`\n5 5 5 5 \n5 5 5 5 \n5 5 5 5 \n5 5 5 5 \n5 5 5 5 \n5 5 5 5 \n5 5 5 5 \n5 5 5 5 \n5 5 5 5 \n5 5 5 5 \n5 5 5 5 \n5 5 5 5 \n5 5 5 5 \n5 5 5 5 \n5 5 5 5 \n5 5 5 5 \n5 5 5 5 \n5 5 5 5 \n5 5 5 5 \n5 5 5 5 \n5 5 5 5 \n5 5 5 5 \n5 5 5 5 \n5 5 5 5 \n`;\n }\n return null;\n })\n\n helpers._registerFactory(\"animation\", function(name: string) {\n switch(helpers.stringTrim(name)) {\n\n }\n return null;\n })\n\n}\n// Auto-generated code. Do not edit.\n",
|
|
171
|
+
"main.blocks": "<xml xmlns=\"https://developers.google.com/blockly/xml\"><variables><variable type=\"KIND_SpriteKind\" id=\"GY;xh:3E#-Q0`bQXH-=K\">Player</variable><variable type=\"KIND_SpriteKind\" id=\"%](8L+$)iLXB(gr[q1VP\">Projectile</variable><variable type=\"KIND_SpriteKind\" id=\"Z-!A#A{tscDOH2FpV`BK\">Food</variable><variable type=\"KIND_SpriteKind\" id=\"@Cjqk^j=14Avc:Ldh@K4\">Enemy</variable><variable type=\"KIND_SpriteKind\" id=\"7R;Ys`NElG]Jt0zjz3^y\">LeftPaddle</variable><variable type=\"KIND_SpriteKind\" id=\"4T[mYc_9GH~eMF3;J3Tq\">RightPaddle</variable><variable type=\"KIND_SpriteKind\" id=\"=R=0`*aWGgy)0^6Fpa8i\">Ball</variable><variable type=\"KIND_SpriteKind\" id=\"V!B3aslyF5Nk,:D$xf:]\">Wall</variable><variable type=\"KIND_SpriteKind\" id=\"uL/=NuFX4AF;dXzq3Bu[\">WallRight</variable><variable type=\"KIND_SpriteKind\" id=\"k_pN[XcA0rUgy.f5a)R{\">WallLeft</variable><variable id=\"G;3kgL(o/K%$weq(nrQV\">ball</variable><variable id=\"T(VrroIqq.[9i1Kvx+9z\">left_paddle</variable><variable id=\"o]G/z11#=Tm4x]aYdmWN\">mySprite</variable><variable id=\"X5AbSi:TF@iPJF}p[?66\">right_paddle</variable><variable id=\"Ac!UHWV~7qD56)=U^Fp_\">myEnemy</variable><variable id=\"vH9lY,Bi#O3@m[8dNDf{\">index</variable><variable id=\"jOn=1LQzJzqV*M1v4Z^p\">wall</variable><variable id=\"lz;wc)j+0tf)BtlQt4|w\">list</variable><variable id=\"2F/F@vbT@4#t5BNzjL7)\">winner</variable></variables></xml>",
|
|
172
|
+
"main.ts": "namespace SpriteKind {\n export const LeftPaddle = SpriteKind.create()\n export const RightPaddle = SpriteKind.create()\n export const Ball = SpriteKind.create()\n export const Wall = SpriteKind.create()\n export const WallRight = SpriteKind.create()\n export const WallLeft = SpriteKind.create()\n}\n",
|
|
173
|
+
"pxt.json": "{\n \"name\": \"pongo - assets only\",\n \"description\": \"\",\n \"dependencies\": {\n \"device\": \"*\"\n },\n \"files\": [\n \"main.blocks\",\n \"main.ts\",\n \"README.md\",\n \"assets.json\",\n \"images.g.jres\",\n \"images.g.ts\",\n \"tilemap.g.jres\",\n \"tilemap.g.ts\"\n ],\n \"targetVersions\": {\n \"branch\": \"v1.6.24\",\n \"tag\": \"v1.6.24\",\n \"commits\": \"https://github.com/microsoft/pxt-arcade/commits/5bea1575ea693e0648a647cbd86cda9776d58f48\",\n \"target\": \"1.6.24\",\n \"pxt\": \"7.2.25\"\n },\n \"preferredEditor\": \"blocksprj\"\n}\n",
|
|
174
|
+
"tilemap.g.jres": "{\n \"transparency16\": {\n \"data\": \"hwQQABAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA==\",\n \"mimeType\": \"image/x-mkcd-f4\",\n \"tilemapTile\": true\n },\n \"*\": {\n \"mimeType\": \"image/x-mkcd-f4\",\n \"dataEncoding\": \"base64\",\n \"namespace\": \"myTiles\"\n }\n}",
|
|
175
|
+
"tilemap.g.ts": "// Auto-generated code. Do not edit.\nnamespace myTiles {\n //% fixedInstance jres blockIdentity=images._tile\n export const transparency16 = image.ofBuffer(hex``);\n\n helpers._registerFactory(\"tile\", function(name: string) {\n switch(helpers.stringTrim(name)) {\n case \"transparency16\":return transparency16;\n }\n return null;\n })\n\n}\n// Auto-generated code. Do not edit.\n"
|
|
176
|
+
}
|
|
177
|
+
```
|
|
@@ -0,0 +1,59 @@
|
|
|
1
|
+
# Pongo
|
|
2
|
+
* name: Pongo
|
|
3
|
+
* description: Add a new take to the classic game of Pong when you follow this tutorial to build Pongo!
|
|
4
|
+
* infoUrl: skillmap/educator-info/pongo-map-info
|
|
5
|
+
* backgroundurl: /static/skillmap/backgrounds/pongo-comp.png
|
|
6
|
+
* bannerurl: /static/skillmap/pongo/pongo2.gif
|
|
7
|
+
* primarycolor: #ff93c4
|
|
8
|
+
* secondarycolor: #fdf60c
|
|
9
|
+
* tertiarycolor: #161112
|
|
10
|
+
* strokecolor: #ffffff
|
|
11
|
+
* highlightcolor: #ffffff
|
|
12
|
+
* completednodecolor: #3b3738
|
|
13
|
+
|
|
14
|
+
## pongo
|
|
15
|
+
* name: Pongo
|
|
16
|
+
* layout: manual
|
|
17
|
+
|
|
18
|
+
### pongo1
|
|
19
|
+
* name: Paddle / Ball
|
|
20
|
+
* type: tutorial
|
|
21
|
+
* description: Add a paddle and ball to start your game of Pongo
|
|
22
|
+
* url: /skillmap/pongo/pongo1
|
|
23
|
+
* tags: easy, sprites, movement
|
|
24
|
+
* imageUrl: /static/skillmap/pongo/pongo1.gif
|
|
25
|
+
* next: pongo2
|
|
26
|
+
* position: 1 -1
|
|
27
|
+
|
|
28
|
+
### pongo2
|
|
29
|
+
* name: Hit the Wall
|
|
30
|
+
* type: tutorial
|
|
31
|
+
* description: Add bricks to the back of the wall. When the bricks are gone, it's game over!
|
|
32
|
+
* url: /skillmap/pongo/pongo2
|
|
33
|
+
* tags: easy, sprites, events
|
|
34
|
+
* imageUrl: /static/skillmap/pongo/pongo2.gif
|
|
35
|
+
* next: pongo3
|
|
36
|
+
* position: 2 -1
|
|
37
|
+
|
|
38
|
+
### pongo3
|
|
39
|
+
* name: Multiplayer
|
|
40
|
+
* type: tutorial
|
|
41
|
+
* description: A few simple changes will turn this into a game you can play with friends.
|
|
42
|
+
* url: /skillmap/pongo/pongo3
|
|
43
|
+
* tags: easy, multiplayer
|
|
44
|
+
* imageUrl: /static/skillmap/pongo/pongo3.gif
|
|
45
|
+
* next: pongo-finish
|
|
46
|
+
* position: 3 0
|
|
47
|
+
|
|
48
|
+
|
|
49
|
+
### pongo-finish
|
|
50
|
+
* kind: completion
|
|
51
|
+
* type: certificate
|
|
52
|
+
* url: /static/skillmap/certificates/pongo-cert.pdf
|
|
53
|
+
* imageUrl: /static/skillmap/certificates/pongo-cert.png
|
|
54
|
+
* position: 4 0
|
|
55
|
+
* actions:
|
|
56
|
+
* map: [Try Save the Forest](/skillmap/forest)
|
|
57
|
+
* map: [Try our Space Explorer](/skillmap/space)
|
|
58
|
+
* editor: [Edit Your Project with a Full Toolbox](/)
|
|
59
|
+
|
package/docs/skillmap/racer.md
CHANGED
|
@@ -18,9 +18,9 @@
|
|
|
18
18
|
* name: Trapped Backstage
|
|
19
19
|
* type: tutorial
|
|
20
20
|
* description: Create a rockstar backstage after the show, then keep an eye on them as they navigate the path!
|
|
21
|
-
* url: /skillmap/rockstar/
|
|
21
|
+
* url: /skillmap/rockstar/racer1
|
|
22
22
|
* tags: easy, sprites, tiles
|
|
23
|
-
* imageUrl: /static/skillmap/
|
|
23
|
+
* imageUrl: /static/skillmap/racer/racer1.gif
|
|
24
24
|
* next: racer2
|
|
25
25
|
* position: 1 -1
|
|
26
26
|
|
|
@@ -28,9 +28,9 @@
|
|
|
28
28
|
* name: Gather Your Gear
|
|
29
29
|
* type: tutorial
|
|
30
30
|
* description: Write the code to give your rockstar points for gathering all their gear before they head out on tour.
|
|
31
|
-
* url: /skillmap/rockstar/
|
|
31
|
+
* url: /skillmap/rockstar/racer2
|
|
32
32
|
* tags: easy, tiles, events
|
|
33
|
-
* imageUrl: /static/skillmap/
|
|
33
|
+
* imageUrl: /static/skillmap/racer/racer2.gif
|
|
34
34
|
* next: racer3
|
|
35
35
|
* position: 2 -1
|
|
36
36
|
|
|
@@ -38,9 +38,9 @@
|
|
|
38
38
|
* name: Avoid the Fans!
|
|
39
39
|
* type: tutorial
|
|
40
40
|
* description: Code some crazed fans who will steal points as souveniers unless the rockstar can avoid them!
|
|
41
|
-
* url: /skillmap/rockstar/
|
|
41
|
+
* url: /skillmap/rockstar/racer3
|
|
42
42
|
* tags: easy, enemies, overlap, lives
|
|
43
|
-
* imageUrl: /static/skillmap/
|
|
43
|
+
* imageUrl: /static/skillmap/racer/racer3.gif
|
|
44
44
|
* next: racer-finish
|
|
45
45
|
* position: 3 0
|
|
46
46
|
|
|
@@ -48,7 +48,7 @@
|
|
|
48
48
|
### racer-finish
|
|
49
49
|
* kind: completion
|
|
50
50
|
* type: certificate
|
|
51
|
-
* url: /static/skillmap/certificates/
|
|
51
|
+
* url: /static/skillmap/certificates/racer-cert.pdf
|
|
52
52
|
* position: 4 0
|
|
53
53
|
* actions:
|
|
54
54
|
* map: [Try Jungle Monkey Jump](/skillmap/jungle)
|
|
@@ -14,7 +14,7 @@ We'll walk you through the skills you'll need to help Jerry navigate backstage t
|
|
|
14
14
|
|
|
15
15
|
## 2. Let's Get Started
|
|
16
16
|
|
|
17
|
-
**Your scene has already been set!**
|
|
17
|
+
**Your scene has already been set!**
|
|
18
18
|
|
|
19
19
|
---
|
|
20
20
|
|
|
@@ -27,16 +27,22 @@ have already been added to this activity.
|
|
|
27
27
|
|
|
28
28
|
## 3. We need a HERO
|
|
29
29
|
|
|
30
|
-
**👏 We need Jerry
|
|
30
|
+
**👏 We need Jerry!**
|
|
31
31
|
|
|
32
|
-
Our
|
|
32
|
+
Our game character is called a [__*sprite*__](#sprote "2-D image that move on the screen"). Let's create a rockstar sprite and get it moving before we do anything else.
|
|
33
33
|
|
|
34
34
|
---
|
|
35
35
|
|
|
36
|
-
- :
|
|
36
|
+
- :paper plane: From the ``||sprites:Sprites||`` category, drag
|
|
37
|
+
``||variables:set [mySprite] to sprite [ ] of kind [Player]||``
|
|
38
|
+
to **the end** of the ``||loops:on start||`` container.
|
|
39
|
+
|
|
40
|
+
_💡 Having trouble finding the block you need? Look to the left of the instructions for the icon of the toolbox category where your block lives!_
|
|
37
41
|
|
|
38
42
|
- :mouse pointer: To add Jerry, click the empty grey box, then toggle to **My Assets** and click **rockstar**.
|
|
39
43
|
|
|
44
|
+

|
|
45
|
+
|
|
40
46
|
|
|
41
47
|
```blocks
|
|
42
48
|
scene.setBackgroundColor(13)
|
|
@@ -48,13 +54,16 @@ let mySprite = sprites.create(assets.image`rockstar`, SpriteKind.Player)
|
|
|
48
54
|
|
|
49
55
|
## 4. Control the Player
|
|
50
56
|
|
|
51
|
-
**Time to get the sprite moving**
|
|
57
|
+
**Time to get the sprite moving**
|
|
52
58
|
|
|
53
59
|
---
|
|
54
60
|
|
|
55
|
-
- :
|
|
61
|
+
- :game: Drag
|
|
62
|
+
``||controller:move [mySprite] with buttons ⊕||``
|
|
56
63
|
to **the end** of the ``||loops:on start||`` container.
|
|
57
64
|
|
|
65
|
+
_💡 Remember, the icon to the left of the instructions shows the same icon as the toolbox category for the block you need._
|
|
66
|
+
|
|
58
67
|
|
|
59
68
|
```blocks
|
|
60
69
|
scene.setBackgroundColor(13)
|
|
@@ -67,7 +76,8 @@ controller.moveSprite(mySprite)
|
|
|
67
76
|
|
|
68
77
|
## 5. Try It
|
|
69
78
|
|
|
70
|
-
|
|
79
|
+
**Click the Game Window Tab (Above)**
|
|
80
|
+

|
|
71
81
|
|
|
72
82
|
---
|
|
73
83
|
|
|
@@ -83,10 +93,17 @@ The rockstar sprite should appear at the stage door.
|
|
|
83
93
|
|
|
84
94
|
---
|
|
85
95
|
|
|
86
|
-
- :
|
|
96
|
+
- :tree: To start Jerry at the stage door, drag
|
|
97
|
+
``||scene: place [mySprite] on top of random [ ]||``
|
|
98
|
+
to **the end** of the
|
|
99
|
+
``||loops:on start||``
|
|
100
|
+
container.
|
|
87
101
|
|
|
88
102
|
- :mouse pointer: Click the checkered tile and select the teal stage door called **stage** from the grid menu.
|
|
89
103
|
|
|
104
|
+
_💡 Don't forget to play with your project after each step to see the changes your code has made._
|
|
105
|
+
|
|
106
|
+
|
|
90
107
|
|
|
91
108
|
```blocks
|
|
92
109
|
scene.setBackgroundColor(13)
|
|
@@ -102,8 +119,10 @@ tiles.placeOnRandomTile(mySprite, assets.tile`stage`)
|
|
|
102
119
|
## 7. Follow with Camera
|
|
103
120
|
|
|
104
121
|
|
|
105
|
-
- :
|
|
106
|
-
``||scene:camera follow sprite [mySprite]||``
|
|
122
|
+
- :tree: Next, to keep Jerry in sight, drag
|
|
123
|
+
``||scene:camera follow sprite [mySprite]||``
|
|
124
|
+
to **the end** of the
|
|
125
|
+
``||loops:on start||`` container.
|
|
107
126
|
|
|
108
127
|
```blocks
|
|
109
128
|
scene.setBackgroundColor(13)
|
|
@@ -119,18 +138,18 @@ scene.cameraFollowSprite(mySprite)
|
|
|
119
138
|
|
|
120
139
|
## 8. Look Again
|
|
121
140
|
|
|
122
|
-
**🕹️ Try your maze in the game window
|
|
141
|
+
**🕹️ Try your maze in the game window**
|
|
123
142
|
|
|
124
143
|
---
|
|
125
144
|
|
|
126
|
-
You should be able to see your sprite as you move it around backstage. Can you make it to the
|
|
145
|
+
You should be able to see your sprite as you move it around backstage. Can you make it to the exit?
|
|
127
146
|
|
|
128
147
|
|
|
129
148
|
|
|
130
149
|
|
|
131
150
|
## Finale
|
|
132
151
|
|
|
133
|
-
🔥 **Well done!** 🔥
|
|
152
|
+
🔥 **Well done!** 🔥
|
|
134
153
|
|
|
135
154
|
---
|
|
136
155
|
|
|
@@ -148,34 +167,6 @@ scene.setBackgroundColor(13)
|
|
|
148
167
|
tiles.setTilemap(tilemap`level1`)
|
|
149
168
|
```
|
|
150
169
|
|
|
151
|
-
```ghost
|
|
152
|
-
scene.onOverlapTile(SpriteKind.Player, assets.tile`instrument3`, function (sprite, location) {
|
|
153
|
-
tiles.setTileAt(location, assets.tile`transparency16`)
|
|
154
|
-
info.changeScoreBy(1)
|
|
155
|
-
})
|
|
156
|
-
scene.onOverlapTile(SpriteKind.Player, assets.tile`instrument2`, function (sprite, location) {
|
|
157
|
-
tiles.setTileAt(location, assets.tile`transparency16`)
|
|
158
|
-
info.changeScoreBy(1)
|
|
159
|
-
})
|
|
160
|
-
scene.onOverlapTile(SpriteKind.Player, assets.tile`instrument1`, function (sprite, location) {
|
|
161
|
-
tiles.setTileAt(location, assets.tile`transparency16`)
|
|
162
|
-
info.changeScoreBy(1)
|
|
163
|
-
})
|
|
164
|
-
scene.onOverlapTile(SpriteKind.Player, assets.tile`door`, function (sprite, location) {
|
|
165
|
-
game.over(true)
|
|
166
|
-
})
|
|
167
|
-
scene.onOverlapTile(SpriteKind.Player, assets.tile`fan1`, function (sprite, location) {
|
|
168
|
-
tiles.setTileAt(location, assets.tile`transparency16`)
|
|
169
|
-
info.changeScoreBy(-1)
|
|
170
|
-
})
|
|
171
|
-
|
|
172
|
-
let mySprite = sprites.create(assets.image`rockstar`, SpriteKind.Player)
|
|
173
|
-
controller.moveSprite(mySprite, 100, 100)
|
|
174
|
-
scene.cameraFollowSprite(mySprite)
|
|
175
|
-
tiles.placeOnRandomTile(mySprite, sprites.dungeon.stairLarge)
|
|
176
|
-
info.startCountdown(60)
|
|
177
|
-
info.setScore(0)
|
|
178
|
-
```
|
|
179
170
|
|
|
180
171
|
|
|
181
172
|
|