pxt-arcade 1.12.2 → 1.12.4
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 -2
- package/built/target.js +158 -146
- package/built/target.json +158 -146
- package/built/targetlight.json +5 -5
- package/built/theme.json +5 -0
- package/docs/SUMMARY.md +1 -0
- package/docs/hardware/adding.md +46 -52
- package/docs/hero-banner.md +8 -8
- package/docs/hour-of-code-2022-es.html +0 -1
- package/docs/hour-of-code-2022-pt.html +0 -1
- package/docs/hour-of-code-2022.html +12 -13
- package/docs/index-ref.json +1 -1
- package/docs/kiosk.html +1 -1
- package/docs/multiplayer.md +135 -0
- package/docs/projects/SUMMARY.md +3 -1
- package/docs/skillmap/balloon/balloon1.md +26 -312
- package/docs/skillmap/balloon/balloon2.md +18 -315
- package/docs/skillmap/balloon/balloon3.md +18 -317
- package/docs/skillmap/balloon/balloon4.md +105 -583
- package/docs/skillmap/balloon.md +14 -13
- package/docs/skillmap/mole/mole1.md +51 -326
- package/docs/skillmap/mole/mole2.md +43 -332
- package/docs/skillmap/mole/mole3.md +47 -316
- package/docs/{test/skillmap → skillmap}/mole/mole4.md +0 -0
- package/docs/skillmap/mole.md +14 -4
- package/docs/skillmap/turkey/turkey1.md +194 -127
- package/docs/skillmap/turkey/turkey2.md +144 -96
- package/docs/skillmap/turkey/turkey3.md +135 -84
- package/docs/skillmap/turkey.md +12 -10
- package/docs/skillmaps.md +24 -8
- package/docs/static/hero-gallery/holiday.png +0 -0
- package/docs/static/kiosk/asset-manifest.json +6 -6
- package/docs/static/kiosk/static/css/main.b60591be.css +2 -0
- package/docs/static/kiosk/static/css/main.b60591be.css.map +1 -0
- package/docs/static/kiosk/static/js/main.7c9f0b91.js +3 -0
- package/docs/static/kiosk/static/js/{main.01c7792a.js.LICENSE.txt → main.7c9f0b91.js.LICENSE.txt} +12 -32
- package/docs/static/kiosk/static/js/main.7c9f0b91.js.map +1 -0
- package/docs/static/multiplayer/help/emojis.png +0 -0
- package/docs/static/multiplayer/help/host-multiplayer.png +0 -0
- package/docs/static/multiplayer/help/hosted-game.png +0 -0
- package/docs/static/multiplayer/help/join-game.png +0 -0
- package/docs/static/multiplayer/help/joined-game.png +0 -0
- package/docs/static/multiplayer/help/share-button.png +0 -0
- package/docs/static/multiplayer/help/start-game.png +0 -0
- package/docs/static/skillmap/assets/dkc-logo-small.png +0 -0
- package/docs/static/tutorials/aliens/reload.png +0 -0
- package/docs/static/tutorials/arrows/2pbg.png +0 -0
- package/docs/static/tutorials/arrows/key.png +0 -0
- package/docs/static/tutorials/arrows/p1.png +0 -0
- package/docs/static/tutorials/arrows/p2.png +0 -0
- package/docs/static/tutorials/holiday/bgd.png +0 -0
- package/docs/static/tutorials/holiday/p1.png +0 -0
- package/docs/static/tutorials/holiday/p2.png +0 -0
- package/docs/static/tutorials/horse/finish.png +0 -0
- package/docs/static/tutorials/horse/frame.png +0 -0
- package/docs/static/tutorials/horse/p1.png +0 -0
- package/docs/static/tutorials/horse/p2.png +0 -0
- package/docs/test/courses/carnival.md +57 -0
- package/docs/test/courses/class-arcade.md +57 -0
- package/docs/test/skillmap/balloon.md +1 -1
- package/docs/test/skillmap/dino/{collectort1.md → dino1.md} +135 -79
- package/docs/test/skillmap/dino/{collectort2.md → dino2.md} +0 -0
- package/docs/test/skillmap/dino/{collectort3.md → dino3.md} +0 -0
- package/docs/test/skillmap/dino/{collectort4.md → dino4.md} +0 -0
- package/docs/test/skillmap/dino/{collectort5.md → dino5.md} +0 -0
- package/docs/test/skillmap/dino.md +82 -0
- package/docs/test/skillmap/mole.md +1 -1
- package/docs/test/skillmap/story/story1.md +8 -21
- package/docs/test/skillmap/story/story2.md +17 -28
- package/docs/test/skillmap/story/story3.md +51 -469
- package/docs/test/skillmap/story/story4.md +1 -2
- package/docs/test/skillmap/turkey.md +1 -0
- package/docs/test/tutorials/arrow.md +677 -0
- package/docs/test/tutorials/debug.md +180 -0
- package/docs/test/tutorials/holiday.md +609 -0
- package/docs/test/tutorials/horse.md +456 -0
- package/docs/test/tutorials/hundred.md +400 -0
- package/docs/test/tutorials/target.md +6 -2
- package/docs/test/tutorials/wakanda-forever.md +206 -147
- package/docs/tutorials/arrow.md +677 -0
- package/docs/tutorials/holiday.md +609 -0
- package/docs/tutorials/horse.md +456 -0
- package/docs/{test/tutorials/target/target_copy.md → tutorials/target.md} +11 -1085
- package/docs/tutorials/wakanda-forever.md +206 -147
- package/package.json +3 -3
- package/docs/skillmap/turkey/turkey0.md +0 -197
- package/docs/skillmap/turkey/turkey1a.md +0 -308
- package/docs/skillmap/turkey/turkey2a.md +0 -277
- package/docs/skillmap/turkey/turkey3a.md +0 -219
- package/docs/static/kiosk/static/css/main.927f4dad.css +0 -2
- package/docs/static/kiosk/static/css/main.927f4dad.css.map +0 -1
- package/docs/static/kiosk/static/js/main.01c7792a.js +0 -3
- package/docs/static/kiosk/static/js/main.01c7792a.js.map +0 -1
- package/docs/test/skillmap/balloon/balloon1.md +0 -247
- package/docs/test/skillmap/balloon/balloon2.md +0 -377
- package/docs/test/skillmap/balloon/balloon3.md +0 -389
- package/docs/test/skillmap/balloon/balloon4.md +0 -385
- package/docs/test/skillmap/mole/mole1.md +0 -382
- package/docs/test/skillmap/mole/mole2.md +0 -422
- package/docs/test/skillmap/mole/mole3.md +0 -384
- package/docs/test/skillmap/turkey/turkey1.md +0 -338
- package/docs/test/skillmap/turkey/turkey2.md +0 -318
- package/docs/test/skillmap/turkey/turkey3.md +0 -265
|
@@ -28,15 +28,6 @@ Press the (A) button or **space bar** as fast as you can. You should see a mous
|
|
|
28
28
|
If your code doesn't work, start by looking to see if you can figure out what is going wrong. Make sure each block is in the correct event container.
|
|
29
29
|
|
|
30
30
|
```blocks
|
|
31
|
-
let myMouse: Sprite = null
|
|
32
|
-
let myBalloon: Sprite = null
|
|
33
|
-
info.startCountdownGame(20, winTypes.Score)
|
|
34
|
-
scene.setBackgroundColor(1)
|
|
35
|
-
myBalloon = sprites.create(assets.image`balloon-1`, SpriteKind.Player)
|
|
36
|
-
myBalloon.setPosition(80, 93)
|
|
37
|
-
let myBooth = sprites.create(assets.image`booth`, SpriteKind.Booth)
|
|
38
|
-
myMouse = sprites.create(assets.image`mouse1-up`, SpriteKind.Mouse)
|
|
39
|
-
myMouse.setPosition(80, 93)
|
|
40
31
|
|
|
41
32
|
controller.A.onEvent(ControllerButtonEvent.Pressed, function () {
|
|
42
33
|
info.player1.changeScoreBy(1)
|
|
@@ -49,9 +40,18 @@ controller.A.onEvent(ControllerButtonEvent.Released, function () {
|
|
|
49
40
|
})
|
|
50
41
|
|
|
51
42
|
sprites.onOverlap(SpriteKind.Player, SpriteKind.Booth, function (sprite, otherSprite) {
|
|
52
|
-
|
|
43
|
+
carnival.onGameOverExpanded(carnival.WinTypes.Multi)
|
|
53
44
|
})
|
|
54
45
|
|
|
46
|
+
let myMouse: Sprite = null
|
|
47
|
+
let myBalloon: Sprite = null
|
|
48
|
+
carnival.startCountdownGame(20, carnival.WinTypes.Lose)
|
|
49
|
+
scene.setBackgroundColor(1)
|
|
50
|
+
myBalloon = sprites.create(assets.image`balloon-1`, SpriteKind.Player)
|
|
51
|
+
myBalloon.setPosition(80, 93)
|
|
52
|
+
let myBooth = sprites.create(assets.image`booth`, SpriteKind.Booth)
|
|
53
|
+
myMouse = sprites.create(assets.image`mouse1-up`, SpriteKind.Mouse)
|
|
54
|
+
myMouse.setPosition(80, 93)
|
|
55
55
|
|
|
56
56
|
```
|
|
57
57
|
|
|
@@ -65,303 +65,145 @@ hint~
|
|
|
65
65
|
|
|
66
66
|
## {3. Add Second Player}
|
|
67
67
|
|
|
68
|
-
|
|
68
|
+
**Repeat your past steps to add a second player!**
|
|
69
69
|
|
|
70
|
-
|
|
70
|
+
To save time, we've connected the blocks you need inside a new category in the toolbox. Can you figure out what you need to do to get Player 2 working?
|
|
71
71
|
|
|
72
|
-
**
|
|
72
|
+
💡 **Tip:** _If you need more help, click through the steps for details._
|
|
73
73
|
|
|
74
74
|
|
|
75
75
|
|
|
76
76
|
|
|
77
|
-
## {4. Add
|
|
77
|
+
## {4. Add the Sprites}
|
|
78
78
|
|
|
79
|
-
- :
|
|
80
|
-
``||controller:on [B] button [Pressed]||`` <br/>
|
|
81
|
-
block to the workspace and also add a point for **player 2** each time it's clicked.
|
|
79
|
+
- :bolt: Look under ``||simplified:Simplified||`` for the bundle of code you need to add to **the end of** the ``||loops(noclick):on start||`` container.
|
|
82
80
|
|
|
81
|
+
- :mouse pointer: Click the empty grey boxes to choose the blue balloon and blue mouse images.
|
|
83
82
|
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
- :paper plane: From the ``||controller: Controller||`` category in the toolbox, grab the<br/>
|
|
87
|
-
``||controller(noclick): on [B] button [pressed]||`` <br/>
|
|
88
|
-
bundle and drop it onto an empty area of your workspace.
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
hint~
|
|
83
|
+
💡 **Tip:** _You can also change the **x** value for the Player 1 sprites to move them left a bit._
|
|
92
84
|
|
|
93
85
|
|
|
94
86
|
~hint Show me... 🕵🏽
|
|
95
87
|
|
|
88
|
+

|
|
96
89
|
|
|
97
|
-

|
|
98
|
-
|
|
99
|
-
hint~
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
#### ~ tutorialhint
|
|
107
|
-
```blocks
|
|
108
|
-
controller.B.onEvent(ControllerButtonEvent.Pressed, function () {
|
|
109
|
-
info.player2.changeScoreBy(1)
|
|
110
|
-
})
|
|
111
|
-
```
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
## {5. Add the Balloon}
|
|
115
|
-
|
|
116
|
-
- :lightbulb: Can you figure out how to add the second balloon for the second player?
|
|
117
|
-
|
|
118
|
-
_(You'll also need to move player 1 to the left, and set player 2 further right.)_
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
~hint Tell me more... 🕵🏽
|
|
122
|
-
|
|
123
|
-
- :paper plane: From the ``||sprites: Sprites||`` category in the toolbox, grab <br/>
|
|
124
|
-
``||variables(sprites): set [myBalloon2] to sprite [ ] of kind [Player]||`` <br/>
|
|
125
|
-
and snap it inside at the **end** of the
|
|
126
|
-
``||loops(noclick): on start||``
|
|
127
|
-
block already in your workspace.
|
|
128
|
-
|
|
129
|
-
- :mouse pointer: Select the image of the blue balloon.
|
|
130
|
-
|
|
131
|
-
- :mouse pointer: Grab <br/>
|
|
132
|
-
``||sprites: set [myBalloon2] position to x [110] y [93]||`` <br/>
|
|
133
|
-
and snap it inside at the **end** of the
|
|
134
|
-
``||loops(noclick): on start||``
|
|
135
|
-
block already in your workspace.
|
|
136
|
-
|
|
137
|
-
- :mouse pointer: Change the positions for the original **myBalloon** and **myMouse** to each have an x value of **50**.
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
hint~
|
|
141
|
-
|
|
142
|
-
~hint Show me! 🕵🏽
|
|
143
|
-
|
|
144
|
-
|
|
145
|
-

|
|
146
90
|
|
|
147
91
|
hint~
|
|
148
92
|
|
|
149
93
|
|
|
150
|
-
|
|
151
|
-
|
|
152
|
-
|
|
153
94
|
#### ~ tutorialhint
|
|
154
95
|
```blocks
|
|
155
|
-
let myBalloon2: Sprite = null
|
|
156
96
|
let myMouse: Sprite = null
|
|
157
97
|
let myBalloon: Sprite = null
|
|
158
|
-
|
|
98
|
+
carnival.startCountdownGame(20, carnival.WinTypes.Lose)
|
|
159
99
|
scene.setBackgroundColor(1)
|
|
160
100
|
myBalloon = sprites.create(assets.image`balloon-1`, SpriteKind.Player)
|
|
161
101
|
myBalloon.setPosition(50, 93)
|
|
162
102
|
let myBooth = sprites.create(assets.image`booth`, SpriteKind.Booth)
|
|
163
103
|
myMouse = sprites.create(assets.image`mouse1-up`, SpriteKind.Mouse)
|
|
164
104
|
myMouse.setPosition(50, 93)
|
|
165
|
-
|
|
166
|
-
myBalloon2.
|
|
167
|
-
|
|
168
|
-
|
|
169
|
-
|
|
170
|
-
|
|
171
|
-
|
|
172
|
-
|
|
173
|
-
## {6. Add the Mouse}
|
|
174
|
-
|
|
175
|
-
- :lightbulb: Now it's time to add the second mouse in front of the second balloon.
|
|
176
|
-
|
|
177
|
-
|
|
178
|
-
~hint Tell me more... 🕵🏽
|
|
179
|
-
|
|
180
|
-
- :paper plane: From the ``||sprites: Sprites||`` category in the toolbox, grab <br/>
|
|
181
|
-
``||variables(sprites): set [myMouse2] to sprite [ ] of kind [Mouse]||`` <br/>
|
|
182
|
-
and snap it inside at the **end** of the
|
|
183
|
-
``||loops(noclick): on start||``
|
|
184
|
-
block already in your workspace.
|
|
185
|
-
|
|
186
|
-
- :mouse pointer: Select the **mouse2-up** image.
|
|
187
|
-
|
|
188
|
-
- :mouse pointer: Grab <br/>
|
|
189
|
-
``||sprites: set [myMouse2] position to x [110] y [93]||`` <br/>
|
|
190
|
-
block and snap it inside at the **end** of the
|
|
191
|
-
``||loops(noclick): on start||``
|
|
192
|
-
block already in your workspace.
|
|
193
|
-
|
|
194
|
-
hint~
|
|
195
|
-
|
|
196
|
-
~hint Show me! 🕵🏽
|
|
197
|
-
|
|
198
|
-
|
|
199
|
-

|
|
200
|
-
|
|
201
|
-
hint~
|
|
105
|
+
simplified.wrap(function () {
|
|
106
|
+
let myBalloon2 = sprites.create(img`.`, SpriteKind.Player)
|
|
107
|
+
myBalloon2.setPosition(110, 93)
|
|
108
|
+
let myMouse2 = sprites.create(img`.`, SpriteKind.Mouse)
|
|
109
|
+
myMouse2.setPosition(110, 93)
|
|
110
|
+
})
|
|
202
111
|
|
|
112
|
+
```
|
|
203
113
|
|
|
204
114
|
|
|
205
|
-
```blockconfig.local
|
|
206
|
-
let myMouse2 = sprites.create(img`.`, SpriteKind.Mouse)
|
|
207
|
-
myMouse2.setPosition(110, 93)
|
|
208
|
-
myMouse2.setImage(img`.`)
|
|
209
|
-
controller.B.onEvent(ControllerButtonEvent.Released, function () {
|
|
210
|
-
myMouse2.setImage(assets.image`mouse2-up`)
|
|
211
|
-
})
|
|
212
|
-
```
|
|
213
115
|
|
|
214
|
-
#### ~ tutorialhint
|
|
215
|
-
```blocks
|
|
216
|
-
let myBalloon2: Sprite = null
|
|
217
|
-
let myMouse: Sprite = null
|
|
218
|
-
let myBalloon: Sprite = null
|
|
219
|
-
let myMouse2: Sprite = null
|
|
220
|
-
info.startCountdown(20)
|
|
221
|
-
scene.setBackgroundColor(1)
|
|
222
|
-
myBalloon = sprites.create(assets.image`balloon-1`, SpriteKind.Player)
|
|
223
|
-
myBalloon.setPosition(50, 93)
|
|
224
|
-
let myBooth = sprites.create(assets.image`booth`, SpriteKind.Booth)
|
|
225
|
-
myMouse = sprites.create(assets.image`mouse1-up`, SpriteKind.Mouse)
|
|
226
|
-
myMouse.setPosition(50, 93)
|
|
227
|
-
myBalloon2 = sprites.create(assets.image`balloon-2`, SpriteKind.Player)
|
|
228
|
-
myBalloon2.setPosition(110, 93)
|
|
229
|
-
myMouse2 = sprites.create(assets.image`mouse2-up`, SpriteKind.Mouse)
|
|
230
|
-
myMouse2.setPosition(110, 93)
|
|
231
|
-
```
|
|
232
116
|
|
|
233
117
|
|
|
118
|
+
## {5. Play Your Game!}
|
|
234
119
|
|
|
120
|
+
**Take a look!**
|
|
235
121
|
|
|
236
|
-
|
|
122
|
+
- :binoculars: Look at your project in the game window. <br/><br/>
|
|
123
|
+
You should see that a second mouse and balloon have appeared.
|
|
237
124
|
|
|
238
|
-
You're almost there!
|
|
239
125
|
|
|
240
|
-
- :lightbulb: Make the second mouse look like it's pushing and releasing the handle when the (B) button is pushed and released.
|
|
241
126
|
|
|
242
|
-
Don't forget to test your game using the (B) button in the **game window** or the **enter** key on the keyboard!
|
|
243
127
|
|
|
244
128
|
|
|
245
|
-
~hint Tell me more... 🕵🏽
|
|
246
129
|
|
|
247
|
-
|
|
248
|
-
``||controller(noclick):on [B] button [Released]||``<br/>
|
|
249
|
-
bundle and drop it into an empty area of the workspace.
|
|
130
|
+
## {6. Player 2 Pressed}
|
|
250
131
|
|
|
251
|
-
- :
|
|
132
|
+
- :game: Now look under ``||controller:Controller||`` for the blocks you need to allow the second mouse to move when Player 2 presses their **A button**.
|
|
252
133
|
|
|
253
|
-
- :
|
|
254
|
-
``||sprites: set [myMouse2] image to [ ]||`` <br/>
|
|
255
|
-
block and snap it into the <br/>
|
|
256
|
-
``||controller(noclick): on [B] button [Pressed]||`` <br/>
|
|
257
|
-
block already in your workspace.
|
|
134
|
+
- :mouse pointer: Drop them in an empty area of the workspace, then click the empty grey box to choose the picture of the second mouse pressing the handle.
|
|
258
135
|
|
|
259
|
-
|
|
136
|
+
💡 **Tip:** _To test these blocks, use the U key on your keyboard to simulate the player 2 A button._
|
|
260
137
|
|
|
261
138
|
|
|
262
|
-
hint~
|
|
263
139
|
|
|
264
140
|
~hint Show me! 🕵🏽
|
|
265
141
|
|
|
266
142
|
|
|
267
|
-

|
|
270
144
|
|
|
271
145
|
|
|
146
|
+
hint~
|
|
272
147
|
|
|
273
|
-
```blockconfig.local
|
|
274
|
-
let myMouse2 = sprites.create(img`.`, SpriteKind.Mouse)
|
|
275
|
-
myMouse2.setPosition(110, 93)
|
|
276
|
-
myMouse2.setImage(img`.`)
|
|
277
|
-
controller.B.onEvent(ControllerButtonEvent.Released, function () {
|
|
278
|
-
myMouse2.setImage(img`.`)
|
|
279
|
-
})
|
|
280
|
-
```
|
|
281
148
|
|
|
282
149
|
|
|
283
150
|
#### ~ tutorialhint
|
|
284
151
|
```blocks
|
|
285
|
-
|
|
286
|
-
|
|
287
|
-
controller.
|
|
152
|
+
let myBalloon2: Sprite = null
|
|
153
|
+
let myMouse2: Sprite = null
|
|
154
|
+
controller.player2.onButtonEvent(ControllerButton.A, ControllerButtonEvent.Pressed, function () {
|
|
288
155
|
info.player2.changeScoreBy(1)
|
|
289
156
|
myMouse2.setImage(assets.image`mouse2-down`)
|
|
290
|
-
|
|
291
|
-
|
|
292
|
-
controller.B.onEvent(ControllerButtonEvent.Released, function () {
|
|
293
|
-
let myMouse2: Sprite = null
|
|
294
|
-
myMouse2.setImage(assets.image`mouse2-up`)
|
|
157
|
+
scaling.scaleByPixels(myBalloon2, 1, ScaleDirection.Uniformly, ScaleAnchor.Bottom)
|
|
295
158
|
})
|
|
296
159
|
```
|
|
297
160
|
|
|
298
161
|
|
|
299
|
-
## {8. Inflate the Balloon}
|
|
300
|
-
|
|
301
162
|
|
|
302
|
-
- :lightbulb: Time to make sure that the second balloon gets bigger with each step.
|
|
303
163
|
|
|
304
164
|
|
|
305
|
-
|
|
165
|
+
## {7. Mouse Up}
|
|
306
166
|
|
|
307
|
-
- :
|
|
308
|
-
``||scaling: change [myBalloon2] scale by [1] pixels [uniformly] anchor [bottom]|| `` <br/>
|
|
309
|
-
and snap it into the <br/>
|
|
310
|
-
``||controller(noclick): on [B] button [pressed]||`` <br/>
|
|
311
|
-
block already in the workspace.
|
|
167
|
+
- :game: Now look under ``||controller:Controller||`` for the blocks you need to make the second mouse return to normal when Player 2 releases the **A button**.
|
|
312
168
|
|
|
169
|
+
- :mouse pointer: Drop them in an empty area of the workspace, then click the empty grey box to choose the picture of the second mouse releasing the handle.
|
|
313
170
|
|
|
314
|
-
hint~
|
|
315
171
|
|
|
316
172
|
~hint Show me! 🕵🏽
|
|
317
173
|
|
|
174
|
+

|
|
318
175
|
|
|
319
|
-

|
|
320
176
|
|
|
321
177
|
hint~
|
|
322
178
|
|
|
323
179
|
|
|
324
180
|
|
|
325
181
|
```blockconfig.local
|
|
326
|
-
let myMouse2 =
|
|
327
|
-
|
|
328
|
-
myMouse2.setImage(img`.`)
|
|
329
|
-
controller.B.onEvent(ControllerButtonEvent.Pressed, function () {
|
|
330
|
-
info.player2.changeScoreBy(1)
|
|
331
|
-
myMouse2.setImage(img`.`)
|
|
332
|
-
scaling.scaleByPixels(myBalloon2, 1, ScaleDirection.Uniformly, ScaleAnchor.Bottom)
|
|
182
|
+
let myMouse2: Sprite = null
|
|
183
|
+
controller.player2.onButtonEvent(ControllerButton.A, ControllerButtonEvent.Released, function () {
|
|
184
|
+
myMouse2.setImage(img`.`)
|
|
333
185
|
})
|
|
334
186
|
```
|
|
335
187
|
|
|
336
|
-
|
|
337
188
|
#### ~ tutorialhint
|
|
338
189
|
```blocks
|
|
339
|
-
|
|
340
|
-
|
|
341
|
-
|
|
342
|
-
info.player2.changeScoreBy(1)
|
|
343
|
-
myMouse2.setImage(assets.image`mouse2-down`)
|
|
344
|
-
scaling.scaleByPixels(myBalloon2, 1, ScaleDirection.Uniformly, ScaleAnchor.Bottom)
|
|
345
|
-
})
|
|
346
|
-
|
|
347
|
-
controller.B.onEvent(ControllerButtonEvent.Released, function () {
|
|
348
|
-
myMouse2.setImage(assets.image`mouse2-up`)
|
|
190
|
+
let myMouse2: Sprite = null
|
|
191
|
+
controller.player2.onButtonEvent(ControllerButton.A, ControllerButtonEvent.Released, function () {
|
|
192
|
+
myMouse2.setImage(assets.image`mouse2-up`)
|
|
349
193
|
})
|
|
350
194
|
```
|
|
351
195
|
|
|
352
196
|
|
|
353
197
|
|
|
354
|
-
|
|
355
198
|
## {8. Play Your Game!}
|
|
356
199
|
|
|
357
200
|
**Try your game!**
|
|
358
201
|
|
|
359
202
|
- :binoculars: Look at your project in full-screen by clicking the **resize** button on the normal game window!
|
|
360
203
|
|
|
361
|
-
Find a friend and have them press the (A) button or **space bar** while you press the
|
|
362
|
-
|
|
363
|
-
|
|
204
|
+
Find a friend and have them press the (A) button or **space bar** while you press the **U** key on the keyboard. Who makes it to the top first?
|
|
364
205
|
|
|
206
|
+

|
|
365
207
|
|
|
366
208
|
|
|
367
209
|
|
|
@@ -369,42 +211,34 @@ Find a friend and have them press the (A) button or **space bar** while you pres
|
|
|
369
211
|
|
|
370
212
|
## {9. Add a Label}
|
|
371
213
|
|
|
372
|
-
Last step
|
|
373
|
-
|
|
374
|
-
- :lightbulb: Add a label to the booth so everyone knows the name of the game!
|
|
375
|
-
|
|
376
|
-
**Play your finished game a few times! Who can get the best 2 out of three?**
|
|
214
|
+
**Last step!**
|
|
377
215
|
|
|
216
|
+
- :ticket: From ``||carnival:Carnival||``, add
|
|
217
|
+
```block
|
|
218
|
+
carnival.addLabelTo("Burstin' Balloons", carnival.Areas.Mid)
|
|
219
|
+
```
|
|
220
|
+
to **the end** of the ``||loops(noclick):on start||`` container to put a label on the booth so everyone knows the name of the game!
|
|
378
221
|
|
|
379
|
-
|
|
380
|
-
|
|
381
|
-
- :arrows alternate vertical: From the ``||scene: Scene||`` category in the toolbox, grab <br/>
|
|
382
|
-
``||scene: add label [Burstin' Balloons] to [middle] of window || `` <br/>
|
|
383
|
-
and snap it into the **top** of the ``||loops(noclick): on start||``
|
|
384
|
-
block already in the workspace.
|
|
222
|
+
**Play your finished game a few times! Who can get the best 2 out of 3?**
|
|
385
223
|
|
|
386
224
|
|
|
387
|
-
hint~
|
|
388
225
|
|
|
389
|
-
💡 ** Tip:** _Now that you have someone to race against, you can right-click <br/>
|
|
390
|
-
``||info: start countdown [20] (s) and game over [high score]||``<br/>
|
|
391
|
-
inside ``||loops(noclick): on start||`` and choose **Delete Blocks**._
|
|
392
226
|
|
|
393
227
|
~hint Show me! 🕵🏽
|
|
394
228
|
|
|
229
|
+

|
|
395
230
|
|
|
396
|
-

|
|
397
231
|
|
|
398
232
|
hint~
|
|
399
233
|
|
|
400
234
|
|
|
401
235
|
|
|
402
236
|
```blockconfig.local
|
|
403
|
-
|
|
404
|
-
|
|
405
|
-
|
|
406
|
-
|
|
407
|
-
|
|
237
|
+
simplified.wrap(function () {
|
|
238
|
+
let myBalloon3 = sprites.create(img`.`, SpriteKind.Player)
|
|
239
|
+
myBalloon3.setPosition(110, 93)
|
|
240
|
+
let myMouse3 = sprites.create(img`.`, SpriteKind.Mouse)
|
|
241
|
+
myMouse3.setPosition(110, 93)
|
|
408
242
|
})
|
|
409
243
|
```
|
|
410
244
|
|
|
@@ -415,7 +249,7 @@ let myBalloon2: Sprite = null
|
|
|
415
249
|
let myMouse: Sprite = null
|
|
416
250
|
let myBalloon: Sprite = null
|
|
417
251
|
let myMouse2: Sprite = null
|
|
418
|
-
|
|
252
|
+
carnival.startCountdownGame(20, carnival.WinTypes.Lose)
|
|
419
253
|
scene.setBackgroundColor(1)
|
|
420
254
|
myBalloon = sprites.create(assets.image`balloon-1`, SpriteKind.Player)
|
|
421
255
|
myBalloon.setPosition(50, 93)
|
|
@@ -427,7 +261,7 @@ myBalloon2.setPosition(110, 93)
|
|
|
427
261
|
myMouse2 = sprites.create(assets.image`mouse2-up`, SpriteKind.Mouse)
|
|
428
262
|
myMouse2.setPosition(110, 93)
|
|
429
263
|
//@highlight
|
|
430
|
-
|
|
264
|
+
carnival.addLabelTo("Burstin' Balloons", carnival.Areas.Mid)
|
|
431
265
|
|
|
432
266
|
```
|
|
433
267
|
|
|
@@ -437,7 +271,7 @@ scene.add_label_to("Burstin' Balloons", areas.Mid)
|
|
|
437
271
|
|
|
438
272
|
**🥳 You've done it 🥳**
|
|
439
273
|
|
|
440
|
-
You've finished
|
|
274
|
+
You've finished your two-player game!
|
|
441
275
|
|
|
442
276
|
When you're ready, click **Done** to return to the skillmap and click the button in the side panel to share your game with friends!
|
|
443
277
|
|
|
@@ -445,27 +279,50 @@ When you're ready, click **Done** to return to the skillmap and click the button
|
|
|
445
279
|
|
|
446
280
|
```blockconfig.global
|
|
447
281
|
let myBalloon2: Sprite = null
|
|
282
|
+
let myMouse2: Sprite = null
|
|
448
283
|
info.player2.changeScoreBy(1)
|
|
449
|
-
|
|
284
|
+
carnival.startCountdownGame(20, carnival.WinTypes.Lose)
|
|
450
285
|
myBalloon2 = sprites.create(img`.`, SpriteKind.Player)
|
|
451
286
|
scene.setBackgroundColor(1)
|
|
452
287
|
myBalloon2.setPosition(110, 93)
|
|
453
288
|
scaling.scaleByPixels(myBalloon2, 1, ScaleDirection.Uniformly, ScaleAnchor.Bottom)
|
|
454
289
|
sprites.onOverlap(SpriteKind.Player, SpriteKind.Booth, function (sprite, otherSprite) { })
|
|
455
|
-
|
|
290
|
+
carnival.onGameOverExpanded(carnival.WinTypes.Multi)
|
|
456
291
|
myMouse2.setImage(img`.`)
|
|
457
292
|
|
|
458
|
-
controller.
|
|
293
|
+
controller.player2.onButtonEvent(ControllerButton.A, ControllerButtonEvent.Pressed, function () {
|
|
294
|
+
info.player2.changeScoreBy(1)
|
|
295
|
+
myMouse2.setImage(img`.`)
|
|
296
|
+
scaling.scaleByPixels(myBalloon2, 1, ScaleDirection.Uniformly, ScaleAnchor.Bottom)
|
|
297
|
+
})
|
|
298
|
+
|
|
299
|
+
carnival.addLabelTo("Burstin' Balloons", carnival.Areas.Mid)
|
|
300
|
+
|
|
301
|
+
simplified.wrap(function () {
|
|
302
|
+
myBalloon2 = sprites.create(img`.`, SpriteKind.Player)
|
|
303
|
+
myBalloon2.setPosition(110, 93)
|
|
304
|
+
myMouse2 = sprites.create(img`.`, SpriteKind.Mouse)
|
|
305
|
+
myMouse2.setPosition(110, 93)
|
|
306
|
+
})
|
|
307
|
+
|
|
308
|
+
controller.player2.onButtonEvent(ControllerButton.A, ControllerButtonEvent.Pressed, function () {
|
|
459
309
|
info.player2.changeScoreBy(1)
|
|
310
|
+
scaling.scaleByPixels(myBalloon2, ScaleDirection.Uniformly, ScaleAnchor.Bottom)
|
|
311
|
+
myMouse2.setImage(img`.`)
|
|
312
|
+
})
|
|
313
|
+
controller.player2.onButtonEvent(ControllerButton.A, ControllerButtonEvent.Released, function () {
|
|
314
|
+
myMouse2.setImage(img`.`)
|
|
460
315
|
})
|
|
461
316
|
|
|
462
|
-
|
|
317
|
+
|
|
318
|
+
|
|
463
319
|
```
|
|
464
320
|
|
|
465
321
|
|
|
466
322
|
```package
|
|
467
|
-
arcade-text=github:microsoft/arcade-text/
|
|
468
323
|
pxt-sprite-scaling=github:microsoft/pxt-common-packages/libs/sprite-scaling
|
|
324
|
+
carnival=github:microsoft/arcade-carnival
|
|
325
|
+
simple-blocks=github:microsoft/arcade-tutorial-extensions/simple-blocks
|
|
469
326
|
```
|
|
470
327
|
|
|
471
328
|
|
|
@@ -482,12 +339,12 @@ controller.A.onEvent(ControllerButtonEvent.Released, function () {
|
|
|
482
339
|
})
|
|
483
340
|
|
|
484
341
|
sprites.onOverlap(SpriteKind.Player, SpriteKind.Booth, function (sprite, otherSprite) {
|
|
485
|
-
|
|
342
|
+
carnival.onGameOverExpanded(carnival.WinTypes.Multi)
|
|
486
343
|
})
|
|
487
344
|
|
|
488
345
|
let myMouse: Sprite = null
|
|
489
346
|
let myBalloon: Sprite = null
|
|
490
|
-
|
|
347
|
+
carnival.startCountdownGame(20, carnival.WinTypes.Lose)
|
|
491
348
|
scene.setBackgroundColor(1)
|
|
492
349
|
myBalloon = sprites.create(assets.image`balloon-1`, SpriteKind.Player)
|
|
493
350
|
myBalloon.setPosition(80, 93)
|
|
@@ -498,356 +355,21 @@ myMouse.setPosition(80, 93)
|
|
|
498
355
|
```
|
|
499
356
|
|
|
500
357
|
|
|
501
|
-
```ghost
|
|
502
|
-
controller.B.onEvent(ControllerButtonEvent.Pressed, function () {
|
|
503
|
-
myMouse2.setImage(assets.image`mouse2-down`)
|
|
504
|
-
scaling.scaleByPixels(myBalloon2, 1, ScaleDirection.Uniformly, ScaleAnchor.Bottom)
|
|
505
|
-
info.player2.changeScoreBy(1)
|
|
506
|
-
})
|
|
507
|
-
controller.A.onEvent(ControllerButtonEvent.Pressed, function () {
|
|
508
|
-
myMouse.setImage(assets.image`mouse1-down`)
|
|
509
|
-
scaling.scaleByPixels(myBalloon, 1, ScaleDirection.Uniformly, ScaleAnchor.Bottom)
|
|
510
|
-
info.player1.changeScoreBy(1)
|
|
511
|
-
})
|
|
512
|
-
controller.A.onEvent(ControllerButtonEvent.Released, function () {
|
|
513
|
-
myMouse.setImage(assets.image`mouse1-up`)
|
|
514
|
-
})
|
|
515
|
-
controller.B.onEvent(ControllerButtonEvent.Released, function () {
|
|
516
|
-
myMouse2.setImage(assets.image`mouse2-up`)
|
|
517
|
-
})
|
|
518
|
-
sprites.onOverlap(SpriteKind.Player, SpriteKind.Booth, function (sprite, otherSprite) {
|
|
519
|
-
game.over(true)
|
|
520
|
-
})
|
|
521
|
-
let myMouse2: Sprite = null
|
|
522
|
-
let myBalloon2: Sprite = null
|
|
523
|
-
let myMouse: Sprite = null
|
|
524
|
-
let myBalloon: Sprite = null
|
|
525
|
-
scene.setBackgroundColor(1)
|
|
526
|
-
let booth = sprites.create(assets.image`booth`, SpriteKind.Booth)
|
|
527
|
-
myBalloon = sprites.create(assets.image`balloon-1`, SpriteKind.Player)
|
|
528
|
-
myMouse = sprites.create(assets.image`mouse1-up`, SpriteKind.Mouse)
|
|
529
|
-
myBalloon2 = sprites.create(assets.image`balloon-2`, SpriteKind.Player)
|
|
530
|
-
myMouse2 = sprites.create(assets.image`mouse2-up`, SpriteKind.Mouse)
|
|
531
|
-
myMouse.setPosition(50, 93)
|
|
532
|
-
myMouse2.setPosition(110, 93)
|
|
533
|
-
myBalloon.setPosition(50, 93)
|
|
534
|
-
myBalloon2.setPosition(110, 93)
|
|
535
|
-
info.player2.changeScoreBy(1)
|
|
536
|
-
scaling.scaleByPixels(myBalloon, 1, ScaleDirection.Uniformly, ScaleAnchor.Bottom)
|
|
537
|
-
|
|
538
|
-
```
|
|
539
|
-
|
|
540
|
-
|
|
541
|
-
|
|
542
358
|
```customts
|
|
543
|
-
|
|
544
|
-
namespace SpriteKind {
|
|
545
|
-
//% isKind
|
|
546
|
-
export const Booth = SpriteKind.create()
|
|
547
|
-
//% isKind
|
|
548
|
-
export const Mouse = SpriteKind.create()
|
|
549
|
-
}
|
|
550
|
-
|
|
551
|
-
enum winTypes {
|
|
552
|
-
//% block="win game"
|
|
553
|
-
Win,
|
|
554
|
-
//% block="lose game"
|
|
555
|
-
Lose,
|
|
556
|
-
//% block="high score"
|
|
557
|
-
Score,
|
|
558
|
-
//% block="multiplayer"
|
|
559
|
-
Multi
|
|
560
|
-
}
|
|
561
|
-
|
|
562
|
-
enum speeds {
|
|
563
|
-
//% block="fast"
|
|
564
|
-
Fast,
|
|
565
|
-
//% block="medium"
|
|
566
|
-
Med,
|
|
567
|
-
//% block="slow"
|
|
568
|
-
Slow
|
|
569
|
-
}
|
|
570
|
-
|
|
571
|
-
enum areas {
|
|
572
|
-
//% block="top"
|
|
573
|
-
Top,
|
|
574
|
-
//% block="middle"
|
|
575
|
-
Mid,
|
|
576
|
-
//% block="bottom"
|
|
577
|
-
Bottom
|
|
578
|
-
}
|
|
579
|
-
|
|
580
|
-
let textSprite: TextSprite = null
|
|
581
|
-
//let fanfare: effects.BackgroundEffect = undefined;
|
|
582
|
-
//let winStyle = winTypes.Score
|
|
583
|
-
|
|
584
|
-
|
|
585
|
-
|
|
586
|
-
namespace scene {
|
|
359
|
+
namespace simplified{
|
|
587
360
|
/**
|
|
588
|
-
*
|
|
589
|
-
* of screen as defined by circuis games
|
|
361
|
+
* just run the code
|
|
590
362
|
*/
|
|
591
|
-
//%
|
|
592
|
-
//%
|
|
593
|
-
|
|
594
|
-
|
|
595
|
-
//% myColor.shadow="colorindexpicker"
|
|
596
|
-
//% myColor.defl=4
|
|
597
|
-
//% myPosition.defl=areas.Bottom
|
|
598
|
-
//% inlineInputMode=inline
|
|
599
|
-
export function add_label_to(myLabel: string, myPosition: areas, myColor?:number) {
|
|
600
|
-
if (!myColor)
|
|
601
|
-
myColor = 4;
|
|
602
|
-
|
|
603
|
-
textSprite = textsprite.create(myLabel, 0, myColor)
|
|
604
|
-
if (myPosition == areas.Bottom) textSprite.setPosition(80, 110);
|
|
605
|
-
if (myPosition == areas.Mid) textSprite.setPosition(80, 50);
|
|
606
|
-
if (myPosition == areas.Top) textSprite.setPosition(80, 20);
|
|
363
|
+
//% block="create player"
|
|
364
|
+
//% handlerStatement=1
|
|
365
|
+
export function wrap(handler: () => void) {
|
|
366
|
+
handler();
|
|
607
367
|
}
|
|
608
368
|
}
|
|
369
|
+
```
|
|
609
370
|
|
|
610
371
|
|
|
611
|
-
namespace info {
|
|
612
|
-
let countdownInitialized = false;
|
|
613
|
-
/**
|
|
614
|
-
* Adds game end style to countdown
|
|
615
|
-
*/
|
|
616
|
-
//% color="#cf6a87"
|
|
617
|
-
//% group=countdown
|
|
618
|
-
//% blockId=start_countdown_game
|
|
619
|
-
//% block="start countdown $myTime (s) and game over $winType || effect $winEffect"
|
|
620
|
-
//% myTime.defl=15
|
|
621
|
-
//% winType.defl=winTypes.Score
|
|
622
|
-
//% winEffect.defl=effects.confetti
|
|
623
|
-
//% inlineInputMode=inline
|
|
624
|
-
export function startCountdownGame(myTime: number, winType: winTypes, winEffect?: effects.BackgroundEffect) {
|
|
625
|
-
if (!winType)
|
|
626
|
-
winType = winTypes.Win;
|
|
627
|
-
if (!winEffect && winType != winTypes.Lose){
|
|
628
|
-
winEffect = effects.confetti;
|
|
629
|
-
}
|
|
630
|
-
else { winEffect = effects.melt;}
|
|
631
|
-
init(winType, winEffect);
|
|
632
|
-
info.startCountdown(myTime)
|
|
633
|
-
|
|
634
|
-
}
|
|
635
|
-
|
|
636
|
-
export function newGameOver(winStyle: winTypes, fanfare: effects.BackgroundEffect) {
|
|
637
|
-
|
|
638
|
-
// Prep default variables for different win types
|
|
639
|
-
let winnerNumber = 1;
|
|
640
|
-
let thisHigh = 0;
|
|
641
|
-
|
|
642
|
-
// Save all scores as relevant to the game.
|
|
643
|
-
info.saveAllScores();
|
|
644
|
-
|
|
645
|
-
// collect the scores before popping the scenes
|
|
646
|
-
const scoreInfo1 = info.player1.getState();
|
|
647
|
-
const scoreInfo2 = info.player2.getState();
|
|
648
|
-
const scoreInfo3 = info.player3.getState();
|
|
649
|
-
const scoreInfo4 = info.player4.getState();
|
|
650
|
-
const highScore = info.highScore();
|
|
651
|
-
const allScores = [scoreInfo1.score, scoreInfo2.score, scoreInfo3.score, scoreInfo4.score];
|
|
652
|
-
|
|
653
|
-
// Find player with highest score
|
|
654
|
-
for (let i = 0; i < 4; i++) {
|
|
655
|
-
if (allScores[i] > thisHigh) {
|
|
656
|
-
thisHigh = allScores[i];
|
|
657
|
-
winnerNumber = i+1;
|
|
658
|
-
}
|
|
659
|
-
}
|
|
660
|
-
// If highest score is higher than saved high, replace
|
|
661
|
-
if (thisHigh > highScore){
|
|
662
|
-
info.saveHighScore(); }
|
|
663
|
-
|
|
664
|
-
|
|
665
|
-
// releasing memory and clear fibers. Do not add anything that releases the fiber until background is set below,
|
|
666
|
-
// or screen will be cleared on the new frame and will not appear as background in the game over screen.
|
|
667
|
-
game.popScene();
|
|
668
|
-
game.pushScene();
|
|
669
|
-
scene.setBackgroundImage(screen.clone());
|
|
670
|
-
|
|
671
|
-
music.powerUp.play();
|
|
672
|
-
|
|
673
|
-
fanfare.startScreenEffect();
|
|
674
|
-
|
|
675
|
-
pause(400);
|
|
676
|
-
|
|
677
|
-
const overDialog = new GameOverDialog(true, thisHigh, highScore, winnerNumber, winStyle);
|
|
678
|
-
scene.createRenderable(scene.HUD_Z, target => {
|
|
679
|
-
overDialog.update();
|
|
680
|
-
target.drawTransparentImage(
|
|
681
|
-
overDialog.image,
|
|
682
|
-
0,
|
|
683
|
-
(screen.height - overDialog.image.height) >> 1
|
|
684
|
-
);
|
|
685
|
-
});
|
|
686
|
-
pause(500); // wait for users to stop pressing keys
|
|
687
|
-
overDialog.displayCursor();
|
|
688
|
-
game.waitAnyButton();
|
|
689
|
-
control.reset();
|
|
690
|
-
|
|
691
|
-
}
|
|
692
372
|
|
|
693
|
-
function init(winStyle: winTypes, fanfare: effects.BackgroundEffect) {
|
|
694
|
-
if (countdownInitialized) return;
|
|
695
|
-
countdownInitialized = true;
|
|
696
|
-
|
|
697
|
-
info.onCountdownEnd(function () {
|
|
698
|
-
if (winStyle == winTypes.Win) {
|
|
699
|
-
game.over(true, fanfare)
|
|
700
|
-
} else if (winStyle == winTypes.Lose) {
|
|
701
|
-
game.over(false, fanfare)
|
|
702
|
-
} else {
|
|
703
|
-
newGameOver(winStyle, fanfare);
|
|
704
|
-
}
|
|
705
|
-
})
|
|
706
|
-
}
|
|
707
|
-
|
|
708
|
-
export class GameOverDialog extends game.BaseDialog {
|
|
709
|
-
protected cursorOn: boolean;
|
|
710
|
-
protected isNewHighScore: boolean;
|
|
711
|
-
|
|
712
|
-
constructor(
|
|
713
|
-
protected win: boolean,
|
|
714
|
-
protected score?: number,
|
|
715
|
-
protected highScore?: number,
|
|
716
|
-
protected winnerNum?: number,
|
|
717
|
-
protected winStyle?: winTypes
|
|
718
|
-
) {
|
|
719
|
-
super(screen.width, 46, img`
|
|
720
|
-
1 1 1
|
|
721
|
-
f f f
|
|
722
|
-
1 1 1
|
|
723
|
-
`);
|
|
724
|
-
this.cursorOn = false;
|
|
725
|
-
this.isNewHighScore = this.score > this.highScore;
|
|
726
|
-
}
|
|
727
|
-
|
|
728
|
-
displayCursor() {
|
|
729
|
-
this.cursorOn = true;
|
|
730
|
-
}
|
|
731
|
-
|
|
732
|
-
update() {
|
|
733
|
-
this.clearInterior();
|
|
734
|
-
this.drawTextCore();
|
|
735
|
-
|
|
736
|
-
if (this.cursorOn) {
|
|
737
|
-
this.drawCursorRow();
|
|
738
|
-
}
|
|
739
|
-
}
|
|
740
|
-
|
|
741
|
-
drawTextCore() {
|
|
742
|
-
const titleHeight = 8;
|
|
743
|
-
if (this.winStyle == winTypes.Multi){
|
|
744
|
-
this.image.printCenter(
|
|
745
|
-
"Player " + this.winnerNum + " wins!",
|
|
746
|
-
titleHeight,
|
|
747
|
-
screen.isMono ? 1 : 5,
|
|
748
|
-
image.font8
|
|
749
|
-
);
|
|
750
|
-
|
|
751
|
-
if (this.score !== undefined) {
|
|
752
|
-
const scoreHeight = 23;
|
|
753
|
-
const highScoreHeight = 34;
|
|
754
|
-
const scoreColor = screen.isMono ? 1 : 2;
|
|
755
|
-
|
|
756
|
-
this.image.printCenter(
|
|
757
|
-
"Score:" + this.score,
|
|
758
|
-
scoreHeight,
|
|
759
|
-
scoreColor,
|
|
760
|
-
image.font8
|
|
761
|
-
);
|
|
762
|
-
|
|
763
|
-
if (this.isNewHighScore) {
|
|
764
|
-
this.image.printCenter(
|
|
765
|
-
"New High Score!",
|
|
766
|
-
highScoreHeight,
|
|
767
|
-
scoreColor,
|
|
768
|
-
image.font5
|
|
769
|
-
);
|
|
770
|
-
} else {
|
|
771
|
-
this.image.printCenter(
|
|
772
|
-
"HI:" + this.highScore,
|
|
773
|
-
highScoreHeight,
|
|
774
|
-
scoreColor,
|
|
775
|
-
image.font8
|
|
776
|
-
);
|
|
777
|
-
}
|
|
778
|
-
}
|
|
779
|
-
}
|
|
780
|
-
else {
|
|
781
|
-
this.image.printCenter(
|
|
782
|
-
"Great Job!",
|
|
783
|
-
titleHeight,
|
|
784
|
-
screen.isMono ? 1 : 5,
|
|
785
|
-
image.font8
|
|
786
|
-
);
|
|
787
|
-
|
|
788
|
-
if (this.score !== undefined) {
|
|
789
|
-
const scoreHeight = 23;
|
|
790
|
-
const highScoreHeight = 34;
|
|
791
|
-
const scoreColor = screen.isMono ? 1 : 2;
|
|
792
|
-
|
|
793
|
-
this.image.printCenter(
|
|
794
|
-
"Score:" + this.score,
|
|
795
|
-
scoreHeight,
|
|
796
|
-
scoreColor,
|
|
797
|
-
image.font8
|
|
798
|
-
);
|
|
799
|
-
|
|
800
|
-
if (this.isNewHighScore) {
|
|
801
|
-
this.image.printCenter(
|
|
802
|
-
"New High Score!",
|
|
803
|
-
highScoreHeight,
|
|
804
|
-
scoreColor,
|
|
805
|
-
image.font5
|
|
806
|
-
);
|
|
807
|
-
} else {
|
|
808
|
-
this.image.printCenter(
|
|
809
|
-
"HI:" + this.highScore,
|
|
810
|
-
highScoreHeight,
|
|
811
|
-
scoreColor,
|
|
812
|
-
image.font8
|
|
813
|
-
);
|
|
814
|
-
}
|
|
815
|
-
}
|
|
816
|
-
}
|
|
817
|
-
}
|
|
818
|
-
}
|
|
819
|
-
}
|
|
820
|
-
|
|
821
|
-
namespace game {
|
|
822
|
-
/**
|
|
823
|
-
* Adds additional end game styles
|
|
824
|
-
*/
|
|
825
|
-
//% color="#8854d0"
|
|
826
|
-
//% group=Gameplay
|
|
827
|
-
//% blockId=on_game_over_expanded
|
|
828
|
-
//% block="game over $winStyle || add effect $winEffect"
|
|
829
|
-
//% winType.defl=winTypes.Win
|
|
830
|
-
//% winEffect.defl=effects.confetti
|
|
831
|
-
//% inlineInputMode=inline
|
|
832
|
-
export function onGameOverExpanded(winStyle: winTypes, winEffect?: effects.BackgroundEffect) {
|
|
833
|
-
if (!winStyle)
|
|
834
|
-
winStyle = winTypes.Win;
|
|
835
|
-
if (!winEffect && winStyle != winTypes.Lose) {
|
|
836
|
-
winEffect = effects.confetti;
|
|
837
|
-
}
|
|
838
|
-
else { winEffect = effects.melt; }
|
|
839
|
-
|
|
840
|
-
if (winStyle == winTypes.Win) {
|
|
841
|
-
game.over(true, winEffect)
|
|
842
|
-
} else if (winStyle == winTypes.Lose) {
|
|
843
|
-
game.over(false, winEffect)
|
|
844
|
-
} else {
|
|
845
|
-
info.newGameOver(winStyle, winEffect);
|
|
846
|
-
}
|
|
847
|
-
}
|
|
848
|
-
}
|
|
849
|
-
|
|
850
|
-
```
|
|
851
373
|
|
|
852
374
|
```assetjson
|
|
853
375
|
{
|