Skip to content

Commit 519fbd3

Browse files
committed
Update main.blocks, main.ts, images.g.jres, images.g.ts, tilemap.g.jres, tilemap.g.ts, main.py
1 parent b53d5c9 commit 519fbd3

File tree

9 files changed

+1084
-635
lines changed

9 files changed

+1084
-635
lines changed

.github/makecode/blocks.png

8.92 KB
Loading

.github/makecode/blocksdiff.png

208 KB
Loading

images.g.jres

Lines changed: 58 additions & 23 deletions
Large diffs are not rendered by default.

images.g.ts

Lines changed: 945 additions & 201 deletions
Large diffs are not rendered by default.

main.blocks

Lines changed: 4 additions & 127 deletions
Large diffs are not rendered by default.

main.py

Lines changed: 20 additions & 137 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,3 @@
1-
def on_hit_wall(sprite, location):
2-
pass
3-
scene.on_hit_wall(SpriteKind.player, on_hit_wall)
4-
51
def on_up_pressed():
62
global jumpcount
73
animation.run_image_animation(jack,
@@ -141,141 +137,19 @@ def on_up_pressed():
141137
jumpcount += 2
142138
controller.up.on_event(ControllerButtonEvent.PRESSED, on_up_pressed)
143139

144-
def on_a_pressed():
145-
pass
146-
controller.A.on_event(ControllerButtonEvent.PRESSED, on_a_pressed)
140+
def on_overlap_tile(sprite, location):
141+
jack.destroy(effects.spray, 500)
142+
info.change_life_by(-1)
143+
jack.set_position(14, 0)
144+
scene.on_overlap_tile(SpriteKind.player,
145+
sprites.builtin.forest_tiles0,
146+
on_overlap_tile)
147+
148+
def on_overlap_tile2(sprite, location):
149+
game.over(True)
150+
scene.on_overlap_tile(SpriteKind.player, sprites.builtin.brick, on_overlap_tile2)
147151

148152
def on_left_pressed():
149-
if controller.left.is_pressed():
150-
animation.run_image_animation(jack,
151-
[img("""
152-
..............................
153-
..............................
154-
..............................
155-
..............................
156-
..............................
157-
............33322222..........
158-
............33333333..........
159-
..........2233333333..........
160-
............ffffffff..........
161-
............ddddddff..........
162-
............dfdddddd..........
163-
...........ddddddddd..........
164-
............fffddddd..........
165-
..............ddd.............
166-
..............ddd.............
167-
..dd.......555555555..........
168-
..dd......d555555555dd........
169-
..ddd....dd555555555ddd.......
170-
...ddd.dddd555555555.ddd......
171-
....dddddd.555555555..dd......
172-
.....ddd...555555555..ddd.....
173-
...........555555555..ddd.....
174-
...........555555555..ddd.....
175-
...........666666666.ddd......
176-
..........66666..66ddddd......
177-
.........66666...66ddd........
178-
........66666....66dd.........
179-
.......66666......666...6fff..
180-
.......6666.......6666.66fff..
181-
........6666.......666666fff..
182-
.........6666......666666fff..
183-
.........6666.......6666..ff..
184-
.........ffff.............ff..
185-
.......ffffff.................
186-
.......ffffff.................
187-
..............................
188-
..............................
189-
..............................
190-
..............................
191-
..............................
192-
"""),
193-
img("""
194-
..............................
195-
..............................
196-
..............................
197-
..............................
198-
............33322222..........
199-
............33333333..........
200-
..........2233333333..........
201-
............ffffffff..........
202-
............ddddddff..........
203-
............dfdddddd..........
204-
...........ddddddddd..........
205-
............fffddddd..........
206-
..............ddd.............
207-
..............ddd.............
208-
...........5555555dddd........
209-
.......dd..55555dddddddd......
210-
.......ddd.555ddddd5.dddd.....
211-
.......ddd.55ddddd55..dddd....
212-
........ddddddddd555...ddd....
213-
........ddddddd55555....ddd...
214-
...........ddd555555....dddd..
215-
...........555555555...ddd....
216-
...........666666666..ddd.....
217-
.......6666666666666..ddd.....
218-
.....666666666..6666...dd.....
219-
.....666666.....6666..........
220-
.....6666......666666.........
221-
......6666.....666666.........
222-
......66666.....66666.........
223-
.......6666fff..666666........
224-
........666fff....66666.......
225-
.........66fff.....6666.......
226-
..........6fff.....ffff.......
227-
............ff...ffffff.......
228-
............ff...ffffff.......
229-
..............................
230-
..............................
231-
..............................
232-
..............................
233-
..............................
234-
"""),
235-
img("""
236-
..............................
237-
..............................
238-
..............................
239-
.............33322222.........
240-
.............33333333.........
241-
...........2233333333.........
242-
.............ffffffff.........
243-
.............ddddddff.........
244-
.............dfdddddd.........
245-
............ddddddddd.........
246-
.............fffddddd.........
247-
...............ddd............
248-
...............ddd............
249-
...dd.......555555555.........
250-
...dd......d555555555dd.......
251-
...ddd....dd555555555ddd......
252-
....ddd.dddd555555555.ddd.....
253-
.....dddddd.555555555..dd.....
254-
......ddd...555555555..ddd....
255-
............555555555..ddd....
256-
............555555555..ddd....
257-
............666666666.ddd.....
258-
...........66666..66ddddd.....
259-
..........66666...66ddd.......
260-
.........66666....66dd........
261-
........66666......666...6fff.
262-
........6666.......6666.66fff.
263-
.........6666.......666666fff.
264-
..........6666......666666fff.
265-
..........6666.......6666..ff.
266-
..........ffff.............ff.
267-
........ffffff................
268-
........ffffff................
269-
..............................
270-
..............................
271-
..............................
272-
..............................
273-
..............................
274-
..............................
275-
..............................
276-
""")],
277-
100,
278-
False)
279153
animation.run_image_animation(jack,
280154
[img("""
281155
..............................
@@ -539,11 +413,20 @@ def on_right_pressed():
539413
False)
540414
controller.right.on_event(ControllerButtonEvent.PRESSED, on_right_pressed)
541415

416+
def doSomething():
417+
pass
418+
419+
420+
def on_life_zero():
421+
game.over(False)
422+
info.on_life_zero(on_life_zero)
423+
542424
jumpcount = 0
543425
jack: Sprite = None
544426
jack = sprites.create(assets.image("""
545427
image
546428
"""), SpriteKind.player)
429+
info.set_life(3)
547430
controller.move_sprite(jack, 100, 0)
548431
scene.set_background_color(9)
549432
tiles.set_tilemap(tilemap("""

main.ts

Lines changed: 18 additions & 138 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,3 @@
1-
scene.onHitWall(SpriteKind.Player, function (sprite, location) {
2-
3-
})
41
controller.up.onEvent(ControllerButtonEvent.Pressed, function () {
52
animation.runImageAnimation(
63
jack,
@@ -139,141 +136,15 @@ controller.up.onEvent(ControllerButtonEvent.Pressed, function () {
139136
jumpcount += 2
140137
}
141138
})
142-
controller.A.onEvent(ControllerButtonEvent.Pressed, function () {
143-
139+
scene.onOverlapTile(SpriteKind.Player, sprites.builtin.forestTiles0, function (sprite, location) {
140+
jack.destroy(effects.spray, 500)
141+
info.changeLifeBy(-1)
142+
doSomething()
143+
})
144+
scene.onOverlapTile(SpriteKind.Player, sprites.builtin.brick, function (sprite, location) {
145+
game.over(true)
144146
})
145147
controller.left.onEvent(ControllerButtonEvent.Pressed, function () {
146-
if (controller.left.isPressed()) {
147-
animation.runImageAnimation(
148-
jack,
149-
[img`
150-
..............................
151-
..............................
152-
..............................
153-
..............................
154-
..............................
155-
............33322222..........
156-
............33333333..........
157-
..........2233333333..........
158-
............ffffffff..........
159-
............ddddddff..........
160-
............dfdddddd..........
161-
...........ddddddddd..........
162-
............fffddddd..........
163-
..............ddd.............
164-
..............ddd.............
165-
..dd.......555555555..........
166-
..dd......d555555555dd........
167-
..ddd....dd555555555ddd.......
168-
...ddd.dddd555555555.ddd......
169-
....dddddd.555555555..dd......
170-
.....ddd...555555555..ddd.....
171-
...........555555555..ddd.....
172-
...........555555555..ddd.....
173-
...........666666666.ddd......
174-
..........66666..66ddddd......
175-
.........66666...66ddd........
176-
........66666....66dd.........
177-
.......66666......666...6fff..
178-
.......6666.......6666.66fff..
179-
........6666.......666666fff..
180-
.........6666......666666fff..
181-
.........6666.......6666..ff..
182-
.........ffff.............ff..
183-
.......ffffff.................
184-
.......ffffff.................
185-
..............................
186-
..............................
187-
..............................
188-
..............................
189-
..............................
190-
`,img`
191-
..............................
192-
..............................
193-
..............................
194-
..............................
195-
............33322222..........
196-
............33333333..........
197-
..........2233333333..........
198-
............ffffffff..........
199-
............ddddddff..........
200-
............dfdddddd..........
201-
...........ddddddddd..........
202-
............fffddddd..........
203-
..............ddd.............
204-
..............ddd.............
205-
...........5555555dddd........
206-
.......dd..55555dddddddd......
207-
.......ddd.555ddddd5.dddd.....
208-
.......ddd.55ddddd55..dddd....
209-
........ddddddddd555...ddd....
210-
........ddddddd55555....ddd...
211-
...........ddd555555....dddd..
212-
...........555555555...ddd....
213-
...........666666666..ddd.....
214-
.......6666666666666..ddd.....
215-
.....666666666..6666...dd.....
216-
.....666666.....6666..........
217-
.....6666......666666.........
218-
......6666.....666666.........
219-
......66666.....66666.........
220-
.......6666fff..666666........
221-
........666fff....66666.......
222-
.........66fff.....6666.......
223-
..........6fff.....ffff.......
224-
............ff...ffffff.......
225-
............ff...ffffff.......
226-
..............................
227-
..............................
228-
..............................
229-
..............................
230-
..............................
231-
`,img`
232-
..............................
233-
..............................
234-
..............................
235-
.............33322222.........
236-
.............33333333.........
237-
...........2233333333.........
238-
.............ffffffff.........
239-
.............ddddddff.........
240-
.............dfdddddd.........
241-
............ddddddddd.........
242-
.............fffddddd.........
243-
...............ddd............
244-
...............ddd............
245-
...dd.......555555555.........
246-
...dd......d555555555dd.......
247-
...ddd....dd555555555ddd......
248-
....ddd.dddd555555555.ddd.....
249-
.....dddddd.555555555..dd.....
250-
......ddd...555555555..ddd....
251-
............555555555..ddd....
252-
............555555555..ddd....
253-
............666666666.ddd.....
254-
...........66666..66ddddd.....
255-
..........66666...66ddd.......
256-
.........66666....66dd........
257-
........66666......666...6fff.
258-
........6666.......6666.66fff.
259-
.........6666.......666666fff.
260-
..........6666......666666fff.
261-
..........6666.......6666..ff.
262-
..........ffff.............ff.
263-
........ffffff................
264-
........ffffff................
265-
..............................
266-
..............................
267-
..............................
268-
..............................
269-
..............................
270-
..............................
271-
..............................
272-
`],
273-
100,
274-
false
275-
)
276-
}
277148
animation.runImageAnimation(
278149
jack,
279150
[img`
@@ -535,12 +406,21 @@ controller.right.onEvent(ControllerButtonEvent.Pressed, function () {
535406
false
536407
)
537408
})
538-
scene.onOverlapTile(SpriteKind.Player, assets.tile`transparency16`, function (sprite, location) {
539-
409+
function doSomething () {
410+
jack = sprites.create(assets.image`image`, SpriteKind.Player)
411+
controller.moveSprite(jack, 100, 0)
412+
scene.setBackgroundColor(9)
413+
tiles.setTilemap(tilemap`level1`)
414+
jack.ay = 250
415+
scene.cameraFollowSprite(jack)
416+
}
417+
info.onLifeZero(function () {
418+
game.over(false)
540419
})
541420
let jumpcount = 0
542421
let jack: Sprite = null
543422
jack = sprites.create(assets.image`image`, SpriteKind.Player)
423+
info.setLife(3)
544424
controller.moveSprite(jack, 100, 0)
545425
scene.setBackgroundColor(9)
546426
tiles.setTilemap(tilemap`level1`)

0 commit comments

Comments
 (0)