pxt-arcade 1.12.7 → 1.12.10
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/target-strings.json +1 -0
- package/built/target.js +1143 -1037
- package/built/target.json +1143 -1037
- package/built/targetlight.json +5 -5
- package/built/theme.json +1 -0
- package/docs/developer/kiosk.md +116 -0
- package/docs/firefox-picture-in-picture.md +29 -0
- package/docs/kiosk.html +1 -1
- package/docs/multiplayer-games.md +56 -0
- package/docs/projects/SUMMARY.md +7 -0
- package/docs/projects.md +6 -0
- package/docs/static/browser-pip/firefox/firefox-settings.png +0 -0
- package/docs/static/browser-pip/firefox/hide-pip-toggle.png +0 -0
- package/docs/static/browser-pip/firefox/pip-icon.png +0 -0
- package/docs/static/developer/kiosk/add-to-kiosk.png +0 -0
- package/docs/static/developer/kiosk/add-your-game.png +0 -0
- package/docs/static/developer/kiosk/keyboard-controls.png +0 -0
- package/docs/static/developer/kiosk/locked-state.png +0 -0
- package/docs/static/developer/kiosk/menu-bar.png +0 -0
- package/docs/static/developer/kiosk/multiple-uploaded-games.png +0 -0
- package/docs/static/developer/kiosk/no-uploaded-games.png +0 -0
- package/docs/static/developer/kiosk/qr-code-enlarged.png +0 -0
- package/docs/static/developer/kiosk/select-a-game.png +0 -0
- package/docs/static/developer/kiosk/share-project.png +0 -0
- package/docs/static/developer/kiosk/shared-project-link.png +0 -0
- package/docs/static/developer/kiosk/shared-project-name.png +0 -0
- package/docs/static/developer/kiosk/single-uploaded-game.png +0 -0
- package/docs/static/hardware/arcade-kiosks/cabinet.png +0 -0
- package/docs/static/kiosk/asset-manifest.json +3 -3
- package/docs/static/kiosk/static/js/{main.0fe8d35c.js → main.3ab95ea3.js} +3 -3
- package/docs/static/kiosk/static/js/{main.0fe8d35c.js.LICENSE.txt → main.3ab95ea3.js.LICENSE.txt} +0 -0
- package/docs/static/kiosk/static/js/main.3ab95ea3.js.map +1 -0
- package/docs/static/multiplayer/tag.png +0 -0
- package/docs/static/skillmap/racer/assets-tab.png +0 -0
- package/docs/static/skillmap/racer/image-editor.png +0 -0
- package/docs/static/skillmap/racer/truck2.png +0 -0
- package/docs/test/hardware/cardboard-arcade.md +139 -0
- package/docs/test/hardware/full-size-kiosk.md +101 -0
- package/docs/test/skillmap/dino/dino1.md +76 -133
- package/docs/test/skillmap/dino/dino2.md +111 -86
- package/docs/test/skillmap/dino/dino3.md +103 -137
- package/docs/test/skillmap/dino/dino4.md +112 -85
- package/docs/test/skillmap/dino/dino5.md +1 -2
- package/docs/test/skillmap/racer/racer-pre.md +147 -0
- package/docs/test/skillmap/racer/racer1.md +245 -0
- package/docs/test/skillmap/racer/racer2.md +220 -0
- package/docs/test/skillmap/racer/racer3.md +174 -0
- package/docs/test/skillmap/star/star1.md +124 -70
- package/docs/test/skillmap/star/star2.md +62 -64
- package/docs/test/skillmap/star/star3.md +48 -53
- package/docs/test/skillmap/star/star4.md +28 -10
- package/docs/test/tutorials/hawk.md +819 -0
- package/docs/test/tutorials/holiday.md +14 -2
- package/package.json +3 -3
- package/pxtarget.json +2 -1
- package/targetconfig.json +12 -5
- package/docs/static/kiosk/static/js/main.0fe8d35c.js.map +0 -1
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
@@ -0,0 +1,139 @@
|
|
|
1
|
+
# MakeCode Arcade Shoebox Controller
|
|
2
|
+
|
|
3
|
+
Want to create your very own DIY Arcade Video Game experience with fun joysticks and buttons? It’s easier than you think! Follow these instructions to use a shoebox as your controller for Arcade games that you play on a computer. Note that these instructions will also work if you want to create a full Arcade cabinet, but instead of using a [Raspberry Pi](https://arcade.makecode.com/hardware/raspberry-pi/cardboard-control-panel), use a computer to power it.
|
|
4
|
+
|
|
5
|
+

|
|
6
|
+
|
|
7
|
+
## Materials
|
|
8
|
+
|
|
9
|
+
* Computer – 1 USB port (or 2 USB ports for 2-player games), internet connection
|
|
10
|
+
* Shoebox
|
|
11
|
+
* 2nd Shoebox (optional) – if you want to be able to support 2-player games
|
|
12
|
+
* 1 joystick, 4 buttons (or 2 joysticks, 6 buttons for 2 shoeboxes) with JST cables and USB – note that you usually order these in an Arcade Game Kit. We used the [Hikig 2-Player LED Arcade DIY Kit for USB](https://www.amazon.com/dp/B07JFXQSM5) which is $45 on Amazon.
|
|
13
|
+
* Pen knife
|
|
14
|
+
* 4 small zip ties (8 for 2 shoeboxes)
|
|
15
|
+
* Pen or Pencil
|
|
16
|
+
* Decorating materials – paint, markers, glitter, stickers, etc.
|
|
17
|
+
|
|
18
|
+

|
|
19
|
+
|
|
20
|
+
## Instructions
|
|
21
|
+
|
|
22
|
+
### Map out the Controls
|
|
23
|
+
|
|
24
|
+
* With a Pen or Pencil, draw out where you would like to place the Joystick and buttons on the top of the shoebox.
|
|
25
|
+
|
|
26
|
+

|
|
27
|
+
|
|
28
|
+
* You will need space for:
|
|
29
|
+
|
|
30
|
+
>* Joystick
|
|
31
|
+
>* **A** button
|
|
32
|
+
>* **B** button
|
|
33
|
+
>* **Menu** button
|
|
34
|
+
>* **Reset** button
|
|
35
|
+
|
|
36
|
+
* Here is how we mapped out our controller panel:
|
|
37
|
+
|
|
38
|
+

|
|
39
|
+
|
|
40
|
+
### Determine orientation of your Joystick
|
|
41
|
+
|
|
42
|
+
* Connect the JST cable between the Joystick and the USB encoder board – you may want to refer to the documentation in your kit to figure out which port to connect to. For our kit, there was only 1 port the right size for the joystick cable.
|
|
43
|
+
|
|
44
|
+

|
|
45
|
+
|
|
46
|
+
* Attach the USB cable between the encoder board and your computer.
|
|
47
|
+
* Open up a MakeCode Arcade game in the browser – i.e. https://makecode.com/_XsCCsy5L1eXr.
|
|
48
|
+
* Use the Joystick to move the player around the screen and mark the correct directions on the Joystick.
|
|
49
|
+
|
|
50
|
+

|
|
51
|
+
|
|
52
|
+

|
|
53
|
+
|
|
54
|
+
## Install Joystick and buttons on shoebox
|
|
55
|
+
|
|
56
|
+
* Disconnect the Joystick from the cable and make sure the black plastic washer and Joystick knob handle are removed.
|
|
57
|
+
* Using the pen knife cut out a small hole in the top of the shoebox to fit the Joystick handle through.
|
|
58
|
+
|
|
59
|
+

|
|
60
|
+
|
|
61
|
+
* From inside the box, push the Joystick handle through the hole.
|
|
62
|
+
|
|
63
|
+

|
|
64
|
+
|
|
65
|
+
* From outside the box, drop the large washer and twist the top ball onto the Joystick handle threads.
|
|
66
|
+
|
|
67
|
+

|
|
68
|
+
|
|
69
|
+
* On the inside of the box, use the pen knife to cut 2 holes in each of the 4 corners of the Joystick mount plate – one through the plate opening, and one on the outside edge of the plate.
|
|
70
|
+
* Make sure the orientation of the Joystick is correct (up is at the top).
|
|
71
|
+
* Thread a zip tie through each of these holes securing the Joystick plate to the top of the box.
|
|
72
|
+
|
|
73
|
+

|
|
74
|
+
|
|
75
|
+
* Using the pen knife, cut holes for the buttons in the top of the box – make sure you don’t cut the holes too big so the buttons don’t fall through.
|
|
76
|
+
|
|
77
|
+

|
|
78
|
+
|
|
79
|
+
* Push the buttons through the top of the box.
|
|
80
|
+
|
|
81
|
+

|
|
82
|
+
|
|
83
|
+
* Then from the inside of the box, turn the black nuts onto the threads at the bottom of the buttons to secure them.
|
|
84
|
+
|
|
85
|
+

|
|
86
|
+
|
|
87
|
+
## Install USB Encoder Board in shoebox
|
|
88
|
+
|
|
89
|
+
* Using the pen knife, make a small hole in the front side of the Shoebox and thread the USB cable through it.
|
|
90
|
+
|
|
91
|
+

|
|
92
|
+
|
|
93
|
+
* Place the USB encoder board inside the shoebox.
|
|
94
|
+
* Connect the USB encoder board to the USB cable.
|
|
95
|
+
|
|
96
|
+

|
|
97
|
+
|
|
98
|
+
## Wire the Joystick and buttons to the USB Encoder Board
|
|
99
|
+
|
|
100
|
+
Different kits may have different ports, so you should check the wiring diagram that comes with your kit. We used the following connection diagram for the Hikig 2-Player Arcade Kit:
|
|
101
|
+
|
|
102
|
+

|
|
103
|
+
|
|
104
|
+
* Connect the Joystick JST cable between the Joystick and the USB encoder board.
|
|
105
|
+
|
|
106
|
+

|
|
107
|
+
|
|
108
|
+
* Connect a JST cable between button **A** and the first pin (K1 in our kit) on the USB encoder board.
|
|
109
|
+
|
|
110
|
+

|
|
111
|
+
|
|
112
|
+
* Connect a JST cable between button **B** and the second pin (K2 in our kit) on the USB encoder board.
|
|
113
|
+
|
|
114
|
+

|
|
115
|
+
|
|
116
|
+
* Connect a JST cable between the **Reset** button and the K11 pin (2nd port from the end in our kit) on the USB encoder board.
|
|
117
|
+
|
|
118
|
+

|
|
119
|
+
|
|
120
|
+
* Connect a JST cable between the **Menu** button and the Start pin (3rd port from the end in our kit) on the USB encoder board.
|
|
121
|
+
|
|
122
|
+

|
|
123
|
+
|
|
124
|
+
## Test
|
|
125
|
+
|
|
126
|
+
* Connect the USB cable to your computer and open up a MakeCode Arcade game in the browser – i.e. https://makecode.com/_XsCCsy5L1eXr.
|
|
127
|
+
* Make sure the Joystick and the buttons all work as expected. If not, troubleshoot by attaching different wires to different pins on the USB encoder board.
|
|
128
|
+
|
|
129
|
+

|
|
130
|
+
|
|
131
|
+
## Decorate!
|
|
132
|
+
|
|
133
|
+
* Use Paint, Markers, Glitter, Tin Foil, Stickers or anything else to really customize your Arcade controller and make it your own!
|
|
134
|
+
|
|
135
|
+
## Player Two Shoebox Controller (optional):
|
|
136
|
+
|
|
137
|
+
If you want to use 2 Arcade controllers for 2-player games, create a second shoebox controller. You will follow the same directions as above for the single player controller, but don't include a **Reset** or **Menu** button. Connect both shoebox controller USB cables to your computer and open a 2-Player MakeCode Arcade game in the browser. Note that whichever controller is connected to the computer first will be the Player 1 controller.
|
|
138
|
+
|
|
139
|
+

|
|
@@ -0,0 +1,101 @@
|
|
|
1
|
+
# Wooden Arcade Cabinet
|
|
2
|
+
|
|
3
|
+
These instructions will show you everything you need to build your own inexpensive full-size arcade cabinet with the help of your local maker space or woodshop.
|
|
4
|
+
|
|
5
|
+

|
|
6
|
+
|
|
7
|
+
### ~ hint
|
|
8
|
+
|
|
9
|
+
#### WARNING: Power Tools required
|
|
10
|
+
|
|
11
|
+
To complete this project, you will need access to power tools.
|
|
12
|
+
Make sure to follow all safety procedures or ask a professional for help.
|
|
13
|
+
|
|
14
|
+
### ~
|
|
15
|
+
|
|
16
|
+
## Materials
|
|
17
|
+
|
|
18
|
+
The cabinet is built out of 3 - 8' x 4' plywood sheets of 1/2" thickness.
|
|
19
|
+
|
|
20
|
+
* **3** - 8' x 4' x 1/2" maple plywood sheets. Feel free to use other sheets based on your availability.
|
|
21
|
+
* **1** - arcade button set for 2 players (https://www.amazon.com/gp/product/B00WDQWK5M)
|
|
22
|
+
* **1** - 22" monitor with HDMI input (https://www.amazon.com/gp/product/B072F3DL6P)
|
|
23
|
+
|
|
24
|
+
Tools needed
|
|
25
|
+
|
|
26
|
+
* jigsaw, router, table saw, impact driver, pin nail gun, wood glue, etc... The kind of tools you find in a wood shop.
|
|
27
|
+
* **1/8"** wood drill bit
|
|
28
|
+
* **1/2"** wood drill bit
|
|
29
|
+
|
|
30
|
+
## Template
|
|
31
|
+
|
|
32
|
+
Cut out this template precisely and keep as you master template for all future cuts.
|
|
33
|
+
|
|
34
|
+

|
|
35
|
+
|
|
36
|
+
## Cut list
|
|
37
|
+
|
|
38
|
+
All units are in inches and degree angles. Add 1/4" to the length when a miter is present, 1/2" when 2 miters are present.
|
|
39
|
+
|
|
40
|
+
| Thickness | Width | Length | Location | Miter Angle
|
|
41
|
+
| --------- | ----- | -------- | -------- | -------
|
|
42
|
+
| 1/2 | 23 | 59 3/4 | K | 22 1/2
|
|
43
|
+
| 1/2 | 23 | 24 7/8 | B | 0
|
|
44
|
+
| 1/2 | 23 | 22 1/2 | A | 0
|
|
45
|
+
| 1/2 | 23 | 18 1/2 | F | 0
|
|
46
|
+
| 1/2 | 23 | 16 1/4 | E | 0
|
|
47
|
+
| 1/2 | 23 | 15 7/8 | J | 22 1/2
|
|
48
|
+
| 1/2 | 23 | 12 15/16 | I | 22 1/2
|
|
49
|
+
| 1/2 | 23 | 12 | G | 31
|
|
50
|
+
| 1/2 | 23 | 11 1/2 | C | 25
|
|
51
|
+
| 1/2 | 23 | 6 1/4 | H | 31
|
|
52
|
+
| 1/2 | 23 | 5 | D | 25
|
|
53
|
+
|
|
54
|
+
You will also need to cut out the 2 sides of the arcade cabinet.
|
|
55
|
+
|
|
56
|
+
## Cut Instructions
|
|
57
|
+
|
|
58
|
+
* Using your profile template, mark 2 profiles on the plywood and cut with a jigsaw.
|
|
59
|
+
|
|
60
|
+

|
|
61
|
+
|
|
62
|
+
* The cuts do not have to be perfect as the router will clean it up.
|
|
63
|
+
|
|
64
|
+

|
|
65
|
+
|
|
66
|
+
* Use a router to clean the edges.
|
|
67
|
+
|
|
68
|
+

|
|
69
|
+
|
|
70
|
+
* Cut and miter all the cuts set aside.
|
|
71
|
+
|
|
72
|
+
## Assembly instructions
|
|
73
|
+
|
|
74
|
+
* Create 2 jigs that let you position boards 1/4" from the side.
|
|
75
|
+
* Cut out various 1" x 1/2" strips needed to secure the boards.
|
|
76
|
+
|
|
77
|
+
For each board,
|
|
78
|
+
|
|
79
|
+
* Cut out 2 strips and glue/pin them to the side.
|
|
80
|
+
* Use the jig to position the boards 1/4" from the sides.
|
|
81
|
+
|
|
82
|
+
Once all the boards are secured, attach the upper side of the arcade and you're done!
|
|
83
|
+
|
|
84
|
+

|
|
85
|
+
|
|
86
|
+
## Control panel
|
|
87
|
+
|
|
88
|
+
Follow the wiring instructions of the [cardboard control panel](/hardware/raspberry-pi/cardboard-control-panel) to wire the buttons and joysticks to the raspberry pi.
|
|
89
|
+
|
|
90
|
+
## Screen
|
|
91
|
+
|
|
92
|
+
* Place the screen on the wood panel and mark the position where the screen touches the wood.
|
|
93
|
+
* Pin nail the attachments to clamp the screen down.
|
|
94
|
+
* Drill holes to allow power and HDMI cables to pass through the back of the screen.
|
|
95
|
+
|
|
96
|
+
To make it easier, we recommend building a jig to position and build this part.
|
|
97
|
+
|
|
98
|
+
## Decoration
|
|
99
|
+
|
|
100
|
+
This is your cabinet, have fun decorating it and personalize it the way you like! We used the
|
|
101
|
+
https://arcade-stencils.glitch.me/ to generate stencils and drawing on our cabinets.
|
|
@@ -39,11 +39,10 @@ let mamaDino = sprites.create(img`.`, SpriteKind.Player)
|
|
|
39
39
|
|
|
40
40
|
and snap it inside at **the bottom** of the ``||loops(noclick): on start||`` block already in the workspace.
|
|
41
41
|
|
|
42
|
-
|
|
43
42
|
~hint Show me how! 🕵🏽
|
|
44
43
|
|
|
45
44
|
|
|
46
|
-

|
|
47
46
|
|
|
48
47
|
hint~
|
|
49
48
|
|
|
@@ -55,6 +54,31 @@ hint~
|
|
|
55
54
|
let mamaDino = sprites.create(img`.`, SpriteKind.Player)
|
|
56
55
|
```
|
|
57
56
|
|
|
57
|
+
## {Step 3}
|
|
58
|
+
|
|
59
|
+
- :paint brush: Click the grey box inside
|
|
60
|
+
```block
|
|
61
|
+
let mamaDino = sprites.create(img`.`, SpriteKind.Player)
|
|
62
|
+
```
|
|
63
|
+
to open the
|
|
64
|
+
image editor and then click the **My Assets** tab.
|
|
65
|
+
|
|
66
|
+
|
|
67
|
+

|
|
68
|
+
|
|
69
|
+
|
|
70
|
+
- :mouse pointer: Choose **Mama** dino and click **Done**.
|
|
71
|
+
|
|
72
|
+

|
|
73
|
+
|
|
74
|
+
|
|
75
|
+
|
|
76
|
+
|
|
77
|
+
#### ~ tutorialhint
|
|
78
|
+
|
|
79
|
+
```blocks
|
|
80
|
+
let mamaDino = sprites.create(assets.image`Mama`, SpriteKind.Player)
|
|
81
|
+
```
|
|
58
82
|
|
|
59
83
|
## {3. Look at Your Game}
|
|
60
84
|
|
|
@@ -71,13 +95,15 @@ You should see Mama Dino in the middle of the screen.
|
|
|
71
95
|
|
|
72
96
|
## {Step 4}
|
|
73
97
|
|
|
74
|
-
**Mama Dino needs to be able to
|
|
98
|
+
**Mama Dino needs to be able to up and down on the screen.**
|
|
99
|
+
|
|
75
100
|
|
|
101
|
+
- :game: From the ``||controller: Controller||`` category, grab
|
|
76
102
|
|
|
77
|
-
- :game: From the ``||controller: Controller||`` category, grab <br/>
|
|
78
103
|
```block
|
|
79
104
|
controller.moveOnlyOnscreenWithArrows(mamaDino, controller.Speeds.Fast)
|
|
80
105
|
```
|
|
106
|
+
|
|
81
107
|
and snap it in at **the end** of the ``||loops(noclick): on start||`` block already in the workspace.
|
|
82
108
|
|
|
83
109
|
|
|
@@ -89,7 +115,6 @@ and snap it in at **the end** of the ``||loops(noclick): on start||`` block alre
|
|
|
89
115
|
|
|
90
116
|
hint~
|
|
91
117
|
|
|
92
|
-
|
|
93
118
|
#### ~ tutorialhint
|
|
94
119
|
|
|
95
120
|
```blocks
|
|
@@ -111,26 +136,31 @@ arrow keys, or **W** and **S** keys.
|
|
|
111
136
|
|
|
112
137
|
## {Step 6}
|
|
113
138
|
|
|
114
|
-
**Let's set the scene
|
|
139
|
+
**Let's set the scene**<br/>
|
|
115
140
|
🖼️ 🖼️ 🖼️
|
|
116
141
|
|
|
117
142
|
---
|
|
118
143
|
|
|
119
144
|
- :paper plane: From ``||scene:Scene||``, grab
|
|
120
|
-
|
|
145
|
+
|
|
146
|
+
```block
|
|
147
|
+
scene.setBackgroundImage(img`.`)
|
|
148
|
+
```
|
|
149
|
+
|
|
121
150
|
and snap it into **the top**
|
|
122
151
|
of the ``||loops:on start||`` container.
|
|
123
152
|
|
|
124
|
-
- :paint brush: Click the **grey square**
|
|
153
|
+
- :paint brush: Click the **grey square** and toggle to **My Assets** to choose the **Freeway** background
|
|
154
|
+
|
|
155
|
+

|
|
125
156
|
|
|
126
157
|
#### ~ tutorialhint
|
|
127
158
|
|
|
128
159
|
```blocks
|
|
129
|
-
let mamaDino = sprites.create(assets.image`Mama`, SpriteKind.Player)
|
|
130
|
-
controller.moveOnlyOnscreenWithArrows(mamaDino, controller.Speeds.Fast)
|
|
131
160
|
//@highlight
|
|
132
161
|
scene.setBackgroundImage(assets.image`Freeway`)
|
|
133
|
-
|
|
162
|
+
let mamaDino = sprites.create(assets.image`Mama`, SpriteKind.Player)
|
|
163
|
+
controller.moveOnlyOnscreenWithArrows(mamaDino, controller.Speeds.Fast)
|
|
134
164
|
```
|
|
135
165
|
|
|
136
166
|
|
|
@@ -142,19 +172,20 @@ scene.setBackgroundImage(assets.image`Freeway`)
|
|
|
142
172
|
|
|
143
173
|
- :arrows alternate: To make it look like the dino is walking along the road,
|
|
144
174
|
go to ``||scroller:Scroller||`` and drag
|
|
145
|
-
|
|
175
|
+
|
|
176
|
+
```block
|
|
177
|
+
scroller.scrollBackgroundWithSpeed(-50, 0)
|
|
178
|
+
```
|
|
179
|
+
|
|
146
180
|
into **the end**
|
|
147
181
|
of the ``||loops:on start||`` container.
|
|
148
182
|
|
|
149
|
-
- :mouse pointer: Stop the background from scrolling vertically by changing the value of **vy** to **0**.
|
|
150
|
-
|
|
151
183
|
#### ~ tutorialhint
|
|
152
184
|
|
|
153
185
|
```blocks
|
|
154
186
|
scene.setBackgroundImage(assets.image`Freeway`)
|
|
155
187
|
let mamaDino = sprites.create(assets.image`Mama`, SpriteKind.Player)
|
|
156
188
|
controller.moveOnlyOnscreenWithArrows(mamaDino, controller.Speeds.Fast)
|
|
157
|
-
mamaDino.setStayInScreen(true)
|
|
158
189
|
//@highlight
|
|
159
190
|
scroller.scrollBackgroundWithSpeed(-50, 0)
|
|
160
191
|
```
|
|
@@ -177,123 +208,42 @@ Let's add some baby dinos for the mama dinosaur to rescue 💚
|
|
|
177
208
|
|
|
178
209
|
---
|
|
179
210
|
|
|
180
|
-
- :redo: From ``||loops:Loops||``, grab
|
|
181
|
-
``||loops:forever||``
|
|
182
|
-
loop container and drag it into
|
|
183
|
-
an empty spot on the workspace.
|
|
184
|
-
|
|
185
|
-
- :paper plane: From ``||sprites:Sprites||``, grab
|
|
186
|
-
``||variables(sprites):set [projectile] to projectile [ ] from side with vx [50] vy [50]||``
|
|
187
|
-
and snap it into the empty
|
|
188
|
-
``||loops:forever||`` container.
|
|
189
|
-
|
|
190
|
-
- :paint brush: Click the **grey square** in the new block and toggle to **My Assets** to choose the **Baby** sprite.
|
|
191
|
-
|
|
192
|
-
#### ~ tutorialhint
|
|
193
|
-
|
|
194
|
-
```blocks
|
|
195
|
-
forever(function () {
|
|
196
|
-
let projectile = sprites.createProjectileFromSide(assets.image`Baby`, 50, 50)
|
|
197
|
-
})
|
|
198
|
-
|
|
199
|
-
```
|
|
200
|
-
|
|
201
|
-
## {Step 10}
|
|
202
|
-
|
|
203
|
-
- :mouse pointer: To make the babies look like they're walking along the road, change
|
|
204
|
-
[__*vx*__](#whatVX "horizontal velocity") (or horizontal speed) to **-90**.
|
|
211
|
+
- :redo: From ``||loops:Loops||``, grab the
|
|
205
212
|
|
|
206
|
-
|
|
207
|
-
|
|
208
|
-
|
|
209
|
-
|
|
210
|
-
```blocks
|
|
213
|
+
```block
|
|
211
214
|
forever(function () {
|
|
212
|
-
let
|
|
215
|
+
let babyDino = sprites.createProjectileFromSide(img`.`, -90, 0)
|
|
216
|
+
babyDino.y = randint(15, 115)
|
|
217
|
+
pause(1000)
|
|
213
218
|
})
|
|
214
|
-
|
|
215
219
|
```
|
|
220
|
+
loop container and drag it into an empty spot on the workspace.
|
|
221
|
+
This will create a new baby dino every second at a random starting height.
|
|
216
222
|
|
|
223
|
+
- :paint brush: Click the **grey square** in the ``||sprites:projectile [ ] from side||`` block for ``||variables(noclick):babyDino||`` and toggle to **My Assets** to choose the **Baby** sprite image.
|
|
217
224
|
|
|
218
|
-
|
|
219
|
-
## {Step 11}
|
|
220
|
-
|
|
221
|
-
**😲 They're flying 😲**
|
|
222
|
-
|
|
223
|
-
If we leave them like this, we won't be able to see them properly. Let's
|
|
224
|
-
send the babies in from a random height each time.
|
|
225
|
-
|
|
226
|
-
---
|
|
227
|
-
|
|
228
|
-
- :paper plane: From ``||sprites:Sprites||``, grab a
|
|
229
|
-
``||sprites:set [mamaDino] [x] to [0]||``
|
|
230
|
-
block and snap it into **the end** of the
|
|
231
|
-
``||loops:forever||`` loop container.
|
|
232
|
-
|
|
233
|
-
- :mouse pointer: Change **mamaDino** to **projectile** using the first dropdown menu.
|
|
234
|
-
|
|
235
|
-
- :mouse pointer: To change their vertical starting point, change **x** to **y** using the other dropdown menu.
|
|
236
|
-
|
|
237
|
-
#### ~ tutorialhint
|
|
238
|
-
```blocks
|
|
225
|
+
```blockconfig.local
|
|
239
226
|
forever(function () {
|
|
240
|
-
let
|
|
241
|
-
|
|
242
|
-
|
|
227
|
+
let babyDino = sprites.createProjectileFromSide(img`.`, -90, 0)
|
|
228
|
+
babyDino.y = randint(15, 115)
|
|
229
|
+
pause(1000)
|
|
243
230
|
})
|
|
244
|
-
|
|
245
231
|
```
|
|
246
232
|
|
|
247
|
-
|
|
248
|
-
## {Step 12}
|
|
249
|
-
|
|
250
|
-
**This is looking great, but they still hover around the top.**
|
|
251
|
-
|
|
252
|
-
---
|
|
253
|
-
- :calculator: In
|
|
254
|
-
``||sprites:set [mamaDino] [y] to [0]||``,
|
|
255
|
-
replace **0** with
|
|
256
|
-
``||math:pick random [0] to [10]||``.
|
|
257
|
-
(From the ``||math:Math||`` category)
|
|
258
|
-
|
|
259
|
-
- :mouse pointer: Help the babies spread out along the road by changing the smallest random number from **0** to **15** and the largest random number from
|
|
260
|
-
**10** to **115**.
|
|
261
|
-
|
|
262
233
|
#### ~ tutorialhint
|
|
263
|
-
```blocks
|
|
264
|
-
forever(function () {
|
|
265
|
-
let projectile = sprites.createProjectileFromSide(assets.image`Baby`, -90, 0)
|
|
266
|
-
projectile.y = randint(15, 115)
|
|
267
|
-
})
|
|
268
|
-
```
|
|
269
|
-
|
|
270
|
-
|
|
271
234
|
|
|
272
|
-
## {Step 13}
|
|
273
|
-
|
|
274
|
-
- :redo: Keep the babies from running out at the speed of light by
|
|
275
|
-
adding a
|
|
276
|
-
``||loops:pause [100] ms||``
|
|
277
|
-
block (from the ``||loops:Loops||``
|
|
278
|
-
category) to **the end** of the
|
|
279
|
-
``||loops:forever||`` loop.
|
|
280
|
-
|
|
281
|
-
- :mouse pointer: Change the pause time to **1000 ms** by clicking in the textbox and typing
|
|
282
|
-
**1000** (or click the dropdown and select **1 second**.)
|
|
283
|
-
|
|
284
|
-
#### ~ tutorialhint
|
|
285
235
|
```blocks
|
|
286
236
|
forever(function () {
|
|
287
|
-
|
|
288
|
-
|
|
237
|
+
//@highlight
|
|
238
|
+
let babyDino = sprites.createProjectileFromSide(assets.image`Baby`, -90, 0)
|
|
239
|
+
babyDino.y = randint(15, 115)
|
|
289
240
|
pause(1000)
|
|
290
241
|
})
|
|
291
|
-
```
|
|
292
|
-
|
|
293
242
|
|
|
243
|
+
```
|
|
294
244
|
|
|
295
245
|
|
|
296
|
-
## {Step
|
|
246
|
+
## {Step 10}
|
|
297
247
|
|
|
298
248
|
**🎆 Congrats 🎆**
|
|
299
249
|
|
|
@@ -305,8 +255,10 @@ When you're done playing, click **Done** to return to the main page and continue
|
|
|
305
255
|
|
|
306
256
|
|
|
307
257
|
```blockconfig.global
|
|
308
|
-
let mamaDino = sprites.create(
|
|
309
|
-
|
|
258
|
+
let mamaDino = sprites.create(assets.image`Mama`, SpriteKind.Player)
|
|
259
|
+
let babyDino = sprites.createProjectileFromSide(assets.image`Baby`, -90, 0)
|
|
260
|
+
scroller.scrollBackgroundWithSpeed(-50, 0)
|
|
261
|
+
babyDino.y = 0
|
|
310
262
|
```
|
|
311
263
|
|
|
312
264
|
|
|
@@ -317,24 +269,15 @@ arcade-background-scroll=github:microsoft/arcade-background-scroll/
|
|
|
317
269
|
|
|
318
270
|
|
|
319
271
|
```ghost
|
|
320
|
-
|
|
321
|
-
let projectile: Sprite = null
|
|
272
|
+
let babyDino: Sprite = null
|
|
322
273
|
|
|
323
274
|
scene.setBackgroundImage(assets.image`Freeway`)
|
|
324
|
-
scroller.scrollBackgroundWithSpeed(-50, 0)
|
|
325
|
-
let mamaDino = sprites.create(assets.image`Mama`, SpriteKind.Player)
|
|
326
275
|
controller.moveOnlyOnscreenWithArrows(mamaDino, controller.Speeds.Fast)
|
|
327
|
-
animation.runImageAnimation(
|
|
328
|
-
mamaDino,
|
|
329
|
-
assets.animation`Mama Moving`,
|
|
330
|
-
100,
|
|
331
|
-
true
|
|
332
|
-
)
|
|
333
276
|
|
|
334
277
|
forever(function () {
|
|
335
|
-
|
|
336
|
-
|
|
337
|
-
pause(
|
|
278
|
+
babyDino = sprites.createProjectileFromSide(assets.image`Baby`, -90, 0)
|
|
279
|
+
babyDino.y = randint(0, 120)
|
|
280
|
+
pause(1000)
|
|
338
281
|
})
|
|
339
282
|
|
|
340
283
|
```
|
|
@@ -359,17 +302,17 @@ namespace controller{
|
|
|
359
302
|
*/
|
|
360
303
|
//% color="#d54322"
|
|
361
304
|
//% blockId=move_only_onscreen_with_arrows
|
|
362
|
-
//% block="move $thisSprite=variables_get(mamaDino)
|
|
305
|
+
//% block="move $thisSprite=variables_get(mamaDino) up or down with speed $mySpeed"
|
|
363
306
|
//% mySpeed.defl=Speeds.Fast
|
|
364
307
|
//% inlineInputMode=inline
|
|
365
308
|
export function moveOnlyOnscreenWithArrows(thisSprite: Sprite, mySpeed: Speeds) {
|
|
366
309
|
thisSprite.setStayInScreen(true)
|
|
367
310
|
if (mySpeed == Speeds.Fast) {
|
|
368
|
-
controller.moveSprite(thisSprite,
|
|
311
|
+
controller.moveSprite(thisSprite, 0, 225)
|
|
369
312
|
} else if (mySpeed == Speeds.Med) {
|
|
370
|
-
controller.moveSprite(thisSprite,
|
|
313
|
+
controller.moveSprite(thisSprite, 0, 175)
|
|
371
314
|
} else {
|
|
372
|
-
controller.moveSprite(thisSprite,
|
|
315
|
+
controller.moveSprite(thisSprite, 0, 100)
|
|
373
316
|
}
|
|
374
317
|
}
|
|
375
318
|
|
|
@@ -387,4 +330,4 @@ namespace controller{
|
|
|
387
330
|
"main.ts": "\n",
|
|
388
331
|
"pxt.json": "{\n \"name\": \"dino - assets only\",\n \"description\": \"\",\n \"dependencies\": {\n \"device\": \"*\",\n \"core\": \"*\",\n \"arcade-background-scroll\": \"github:microsoft/arcade-background-scroll/\"\n },\n \"files\": [\n \"main.blocks\",\n \"main.ts\",\n \"README.md\",\n \"assets.json\",\n \"images.g.jres\",\n \"images.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"
|
|
389
332
|
}
|
|
390
|
-
```
|
|
333
|
+
```
|