Skip to content

Commit 7d7ce7f

Browse files
committed
Update main.blocks, main.ts
1 parent c9b7a4d commit 7d7ce7f

File tree

4 files changed

+140
-134
lines changed

4 files changed

+140
-134
lines changed

.github/makecode/blocks.png

20.4 KB
Loading

.github/makecode/blocksdiff.png

16.6 KB
Loading

main.blocks

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
<xml xmlns="https://developers.google.com/blockly/xml"><variables><variable type="KIND_SpriteKind" id="hFWJ*xt2lNVHYWS*TAD[">Player</variable><variable type="KIND_SpriteKind" id="bGoe,2%D6^nC8x29jvQ2">Projectile</variable><variable type="KIND_SpriteKind" id="1;/?(@l9gt*K7$I-(RLl">Food</variable><variable type="KIND_SpriteKind" id="KgN(pk/MJxvr]20?i+hJ">Enemy</variable><variable id="U=@F7e`W`U:,]M18hR(/">mySprite</variable><variable id="R|#mU4)k(~qzC~}2L4tW">jack</variable></variables><block type="pxt-on-start" id="q1Lt!2Qbk32p/tX7FhiZ" x="0" y="0"><statement name="HANDLER"><block type="variables_set" id="*[rF*d`oGWFVj]62lM~l"><field name="VAR" id="R|#mU4)k(~qzC~}2L4tW">jack</field><value name="VALUE"><shadow xmlns="http://www.w3.org/1999/xhtml" type="math_number"><field name="NUM">0</field></shadow><block type="spritescreate" id="wkTp[a`[];AAilhCqXJ#"><value name="img"><shadow type="screen_image_picker" id="4}pf3)hAIlI}5-?1-:sX"><field name="img">assets.image`image`</field><data>{"commentRefs":[],"fieldData":{"img":"myImages.image1"}}</data></shadow></value><value name="kind"><shadow type="spritekind" id="2i8wk-M6gKi~C[5-cgvC"><field name="MEMBER">Player</field></shadow></value></block></value><next><block type="game_control_sprite" id="|-v7nFpZGdleFmD)35iR"><mutation xmlns="http://www.w3.org/1999/xhtml" _expanded="0" _input_init="false"></mutation><value name="sprite"><block type="variables_get" id="w[oFA3k5|Zz*X{z7C=_3"><field name="VAR" id="R|#mU4)k(~qzC~}2L4tW">jack</field></block></value><next><block type="gamesetbackgroundcolor" id=":#)^14-JSbY.B?5cU3u@"><value name="color"><shadow type="colorindexpicker" id="C8n)M(HoEgaE31xo4(l0"><field name="index">9</field></shadow></value><next><block type="tilemap_editor" id="gib4zz:;T}u,lQ{k$^bP"><field name="tilemap">tilemap`level1`</field><data>{"commentRefs":[],"fieldData":{"tilemap":"level1"}}</data><next><block type="Sprite_blockCombine_set" id="{Rhml1flps#mX+/w#z_^"><field name="property">Sprite.ay@set</field><value name="mySprite"><block type="variables_get" id="J[:MzH.$y}SIxaYjfgkJ"><field name="VAR" id="R|#mU4)k(~qzC~}2L4tW">jack</field></block></value><value name="value"><shadow type="math_number" id="L3hj(ky?oQ5WEjwmsHt@"><field name="NUM">250</field></shadow></value><next><block type="camerafollow" id=")l]q}cmIk4a-`1~bn@Tm"><value name="sprite"><block type="variables_get" id="Tp?+DnW_zq/ng2c^?*X0"><field name="VAR" id="R|#mU4)k(~qzC~}2L4tW">jack</field></block></value></block></next></block></next></block></next></block></next></block></next></block></statement></block><block type="keyonevent" id="`.`e(_;~1U:Ae5.G/3;H" x="470" y="290"><field name="button">controller.right</field><field name="event">ControllerButtonEvent.Pressed</field><statement name="HANDLER"><block type="run_image_animation" id="lG.?h`GW#VFdGfzfG;w4"><value name="sprite"><block type="variables_get" id="$gCA,H$U^@[email protected]"><field name="VAR" id="R|#mU4)k(~qzC~}2L4tW">jack</field></block></value><value name="frames"><block type="animation_editor" id="flhk65;%nuAlEi1kLva-"><field name="frames">[img`
1+
<xml xmlns="https://developers.google.com/blockly/xml"><variables><variable type="KIND_SpriteKind" id="hFWJ*xt2lNVHYWS*TAD[">Player</variable><variable type="KIND_SpriteKind" id="bGoe,2%D6^nC8x29jvQ2">Projectile</variable><variable type="KIND_SpriteKind" id="1;/?(@l9gt*K7$I-(RLl">Food</variable><variable type="KIND_SpriteKind" id="KgN(pk/MJxvr]20?i+hJ">Enemy</variable><variable id="U=@F7e`W`U:,]M18hR(/">mySprite</variable><variable id="R|#mU4)k(~qzC~}2L4tW">jack</variable></variables><block type="pxt-on-start" id="q1Lt!2Qbk32p/tX7FhiZ" x="66" y="62"><statement name="HANDLER"><block type="variables_set" id="*[rF*d`oGWFVj]62lM~l"><field name="VAR" id="R|#mU4)k(~qzC~}2L4tW">jack</field><value name="VALUE"><shadow xmlns="http://www.w3.org/1999/xhtml" type="math_number"><field name="NUM">0</field></shadow><block type="spritescreate" id="wkTp[a`[];AAilhCqXJ#"><value name="img"><shadow type="screen_image_picker" id="4}pf3)hAIlI}5-?1-:sX"><field name="img">assets.image`image`</field><data>{"commentRefs":[],"fieldData":{"img":"myImages.image1"}}</data></shadow></value><value name="kind"><shadow type="spritekind" id="2i8wk-M6gKi~C[5-cgvC"><field name="MEMBER">Player</field></shadow></value></block></value><next><block type="game_control_sprite" id="|-v7nFpZGdleFmD)35iR"><mutation xmlns="http://www.w3.org/1999/xhtml" _expanded="2" _input_init="true"></mutation><value name="sprite"><block type="variables_get" id="w[oFA3k5|Zz*X{z7C=_3"><field name="VAR" id="R|#mU4)k(~qzC~}2L4tW">jack</field></block></value><value name="vx"><shadow type="math_number" id="[hUbRW}QVC(4MU_gxuAr"><field name="NUM">100</field></shadow></value><value name="vy"><shadow type="math_number" id="BZ{1%@jH3fSpQMhr{CR["><field name="NUM">0</field></shadow></value><next><block type="gamesetbackgroundcolor" id=":#)^14-JSbY.B?5cU3u@"><value name="color"><shadow type="colorindexpicker" id="C8n)M(HoEgaE31xo4(l0"><field name="index">9</field></shadow></value><next><block type="tilemap_editor" id="gib4zz:;T}u,lQ{k$^bP"><field name="tilemap">tilemap`level1`</field><data>{"commentRefs":[],"fieldData":{"tilemap":"level1"}}</data><next><block type="Sprite_blockCombine_set" id="{Rhml1flps#mX+/w#z_^"><field name="property">Sprite.ay@set</field><value name="mySprite"><block type="variables_get" id="J[:MzH.$y}SIxaYjfgkJ"><field name="VAR" id="R|#mU4)k(~qzC~}2L4tW">jack</field></block></value><value name="value"><shadow type="math_number" id="L3hj(ky?oQ5WEjwmsHt@"><field name="NUM">250</field></shadow></value><next><block type="camerafollow" id=")l]q}cmIk4a-`1~bn@Tm"><value name="sprite"><block type="variables_get" id="Tp?+DnW_zq/ng2c^?*X0"><field name="VAR" id="R|#mU4)k(~qzC~}2L4tW">jack</field></block></value></block></next></block></next></block></next></block></next></block></next></block></statement></block><block type="keyonevent" id="7;DD*snXbKL/ahQi)5-Q" x="850" y="110"><field name="button">controller.A</field><field name="event">ControllerButtonEvent.Pressed</field></block><block type="keyonevent" id="`.`e(_;~1U:Ae5.G/3;H" x="470" y="290"><field name="button">controller.right</field><field name="event">ControllerButtonEvent.Repeated</field><statement name="HANDLER"><block type="run_image_animation" id="lG.?h`GW#VFdGfzfG;w4"><value name="sprite"><block type="variables_get" id="$gCA,H$U^@[email protected]"><field name="VAR" id="R|#mU4)k(~qzC~}2L4tW">jack</field></block></value><value name="frames"><block type="animation_editor" id="flhk65;%nuAlEi1kLva-"><field name="frames">[img`
22
..............................
33
..............................
44
..............................
@@ -244,4 +244,4 @@
244244
..............................
245245
..............................
246246
..............................
247-
`]</field><data>{"commentRefs":[],"fieldData":{"frames":"myAnimations.anim3"}}</data></block></value><value name="frameInterval"><shadow type="timePicker" id="F`4{z4ue=/2D!j]ln9+c"><field name="ms">500</field></shadow></value><value name="loop"><shadow type="toggleOnOff" id="]6=s)+ccFjlKKY(ekzt%"><field name="on">false</field></shadow></value></block></statement></block></xml>
247+
`]</field><data>{"commentRefs":[],"fieldData":{"frames":"myAnimations.anim3"}}</data></block></value><value name="frameInterval"><shadow type="timePicker" id="F`4{z4ue=/2D!j]ln9+c"><field name="ms">100</field></shadow></value><value name="loop"><shadow type="toggleOnOff" id="]6=s)+ccFjlKKY(ekzt%"><field name="on">false</field></shadow></value></block></statement></block><block type="keyonevent" id="Rs:zvR?GNGCuoD^$1$pc" x="470" y="670"><field name="button">controller.up</field><field name="event">ControllerButtonEvent.Pressed</field><statement name="HANDLER"><block type="Sprite_blockCombine_set" id="kX/PoC@pY4uZN)e?5nE?"><field name="property">Sprite.vy@set</field><value name="mySprite"><block type="variables_get" id="_;]]$5zLi[;[|F{*lKpr"><field name="VAR" id="R|#mU4)k(~qzC~}2L4tW">jack</field></block></value><value name="value"><shadow type="math_number" id="t$=X=Q;)gtRt[a{ZaX1m"><field name="NUM">-100</field></shadow></value></block></statement></block></xml>

main.ts

Lines changed: 138 additions & 132 deletions
Original file line numberDiff line numberDiff line change
@@ -1,135 +1,10 @@
1-
controller.left.onEvent(ControllerButtonEvent.Pressed, function () {
2-
animation.runImageAnimation(
3-
jack,
4-
[img`
5-
..............................
6-
..............................
7-
..............................
8-
..............................
9-
..............................
10-
............33322222..........
11-
............33333333..........
12-
..........2233333333..........
13-
............ffffffff..........
14-
............ddddddff..........
15-
............dfdddddd..........
16-
...........ddddddddd..........
17-
............fffddddd..........
18-
..............ddd.............
19-
..............ddd.............
20-
..dd.......555555555..........
21-
..dd......d555555555dd........
22-
..ddd....dd555555555ddd.......
23-
...ddd.dddd555555555.ddd......
24-
....dddddd.555555555..dd......
25-
.....ddd...555555555..ddd.....
26-
...........555555555..ddd.....
27-
...........555555555..ddd.....
28-
...........666666666.ddd......
29-
..........66666..66ddddd......
30-
.........66666...66ddd........
31-
........66666....66dd.........
32-
.......66666......666...6fff..
33-
.......6666.......6666.66fff..
34-
........6666.......666666fff..
35-
.........6666......666666fff..
36-
.........6666.......6666..ff..
37-
.........ffff.............ff..
38-
.......ffffff.................
39-
.......ffffff.................
40-
..............................
41-
..............................
42-
..............................
43-
..............................
44-
..............................
45-
`,img`
46-
..............................
47-
..............................
48-
..............................
49-
..............................
50-
............33322222..........
51-
............33333333..........
52-
..........2233333333..........
53-
............ffffffff..........
54-
............ddddddff..........
55-
............dfdddddd..........
56-
...........ddddddddd..........
57-
............fffddddd..........
58-
..............ddd.............
59-
..............ddd.............
60-
...........5555555dddd........
61-
.......dd..55555dddddddd......
62-
.......ddd.555ddddd5.dddd.....
63-
.......ddd.55ddddd55..dddd....
64-
........ddddddddd555...ddd....
65-
........ddddddd55555....ddd...
66-
...........ddd555555....dddd..
67-
...........555555555...ddd....
68-
...........666666666..ddd.....
69-
.......6666666666666..ddd.....
70-
.....666666666..6666...dd.....
71-
.....666666.....6666..........
72-
.....6666......666666.........
73-
......6666.....666666.........
74-
......66666.....66666.........
75-
.......6666fff..666666........
76-
........666fff....66666.......
77-
.........66fff.....6666.......
78-
..........6fff.....ffff.......
79-
............ff...ffffff.......
80-
............ff...ffffff.......
81-
..............................
82-
..............................
83-
..............................
84-
..............................
85-
..............................
86-
`,img`
87-
..............................
88-
..............................
89-
..............................
90-
.............33322222.........
91-
.............33333333.........
92-
...........2233333333.........
93-
.............ffffffff.........
94-
.............ddddddff.........
95-
.............dfdddddd.........
96-
............ddddddddd.........
97-
.............fffddddd.........
98-
...............ddd............
99-
...............ddd............
100-
...dd.......555555555.........
101-
...dd......d555555555dd.......
102-
...ddd....dd555555555ddd......
103-
....ddd.dddd555555555.ddd.....
104-
.....dddddd.555555555..dd.....
105-
......ddd...555555555..ddd....
106-
............555555555..ddd....
107-
............555555555..ddd....
108-
............666666666.ddd.....
109-
...........66666..66ddddd.....
110-
..........66666...66ddd.......
111-
.........66666....66dd........
112-
........66666......666...6fff.
113-
........6666.......6666.66fff.
114-
.........6666.......666666fff.
115-
..........6666......666666fff.
116-
..........6666.......6666..ff.
117-
..........ffff.............ff.
118-
........ffffff................
119-
........ffffff................
120-
..............................
121-
..............................
122-
..............................
123-
..............................
124-
..............................
125-
..............................
126-
..............................
127-
`],
128-
500,
129-
false
130-
)
1+
controller.up.onEvent(ControllerButtonEvent.Pressed, function () {
2+
jack.vy = -100
1313
})
132-
controller.right.onEvent(ControllerButtonEvent.Pressed, function () {
4+
controller.A.onEvent(ControllerButtonEvent.Pressed, function () {
5+
6+
})
7+
controller.right.onEvent(ControllerButtonEvent.Repeated, function () {
1338
animation.runImageAnimation(
1349
jack,
13510
[img`
@@ -260,9 +135,140 @@ controller.right.onEvent(ControllerButtonEvent.Pressed, function () {
260135
false
261136
)
262137
})
138+
controller.left.onEvent(ControllerButtonEvent.Pressed, function () {
139+
animation.runImageAnimation(
140+
jack,
141+
[img`
142+
..............................
143+
..............................
144+
..............................
145+
..............................
146+
..............................
147+
............33322222..........
148+
............33333333..........
149+
..........2233333333..........
150+
............ffffffff..........
151+
............ddddddff..........
152+
............dfdddddd..........
153+
...........ddddddddd..........
154+
............fffddddd..........
155+
..............ddd.............
156+
..............ddd.............
157+
..dd.......555555555..........
158+
..dd......d555555555dd........
159+
..ddd....dd555555555ddd.......
160+
...ddd.dddd555555555.ddd......
161+
....dddddd.555555555..dd......
162+
.....ddd...555555555..ddd.....
163+
...........555555555..ddd.....
164+
...........555555555..ddd.....
165+
...........666666666.ddd......
166+
..........66666..66ddddd......
167+
.........66666...66ddd........
168+
........66666....66dd.........
169+
.......66666......666...6fff..
170+
.......6666.......6666.66fff..
171+
........6666.......666666fff..
172+
.........6666......666666fff..
173+
.........6666.......6666..ff..
174+
.........ffff.............ff..
175+
.......ffffff.................
176+
.......ffffff.................
177+
..............................
178+
..............................
179+
..............................
180+
..............................
181+
..............................
182+
`,img`
183+
..............................
184+
..............................
185+
..............................
186+
..............................
187+
............33322222..........
188+
............33333333..........
189+
..........2233333333..........
190+
............ffffffff..........
191+
............ddddddff..........
192+
............dfdddddd..........
193+
...........ddddddddd..........
194+
............fffddddd..........
195+
..............ddd.............
196+
..............ddd.............
197+
...........5555555dddd........
198+
.......dd..55555dddddddd......
199+
.......ddd.555ddddd5.dddd.....
200+
.......ddd.55ddddd55..dddd....
201+
........ddddddddd555...ddd....
202+
........ddddddd55555....ddd...
203+
...........ddd555555....dddd..
204+
...........555555555...ddd....
205+
...........666666666..ddd.....
206+
.......6666666666666..ddd.....
207+
.....666666666..6666...dd.....
208+
.....666666.....6666..........
209+
.....6666......666666.........
210+
......6666.....666666.........
211+
......66666.....66666.........
212+
.......6666fff..666666........
213+
........666fff....66666.......
214+
.........66fff.....6666.......
215+
..........6fff.....ffff.......
216+
............ff...ffffff.......
217+
............ff...ffffff.......
218+
..............................
219+
..............................
220+
..............................
221+
..............................
222+
..............................
223+
`,img`
224+
..............................
225+
..............................
226+
..............................
227+
.............33322222.........
228+
.............33333333.........
229+
...........2233333333.........
230+
.............ffffffff.........
231+
.............ddddddff.........
232+
.............dfdddddd.........
233+
............ddddddddd.........
234+
.............fffddddd.........
235+
...............ddd............
236+
...............ddd............
237+
...dd.......555555555.........
238+
...dd......d555555555dd.......
239+
...ddd....dd555555555ddd......
240+
....ddd.dddd555555555.ddd.....
241+
.....dddddd.555555555..dd.....
242+
......ddd...555555555..ddd....
243+
............555555555..ddd....
244+
............555555555..ddd....
245+
............666666666.ddd.....
246+
...........66666..66ddddd.....
247+
..........66666...66ddd.......
248+
.........66666....66dd........
249+
........66666......666...6fff.
250+
........6666.......6666.66fff.
251+
.........6666.......666666fff.
252+
..........6666......666666fff.
253+
..........6666.......6666..ff.
254+
..........ffff.............ff.
255+
........ffffff................
256+
........ffffff................
257+
..............................
258+
..............................
259+
..............................
260+
..............................
261+
..............................
262+
..............................
263+
..............................
264+
`],
265+
100,
266+
false
267+
)
268+
})
263269
let jack: Sprite = null
264270
jack = sprites.create(assets.image`image`, SpriteKind.Player)
265-
controller.moveSprite(jack)
271+
controller.moveSprite(jack, 100, 0)
266272
scene.setBackgroundColor(9)
267273
tiles.setTilemap(tilemap`level1`)
268274
jack.ay = 250

0 commit comments

Comments
 (0)