Skip to content

Commit 24c6952

Browse files
committed
Update main.blocks, main.ts, images.g.jres, images.g.ts, main.py
1 parent 50d2bc9 commit 24c6952

File tree

7 files changed

+46
-31
lines changed

7 files changed

+46
-31
lines changed

.github/makecode/blocks.png

51.8 KB
Loading

.github/makecode/blocksdiff.png

417 KB
Loading

images.g.jres

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,11 @@
2424
"mimeType": "image/x-mkcd-f4",
2525
"displayName": "image7"
2626
},
27-
"image6": "hwQQABAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAABARAQAAAAAAERVRAAAAABAVFVFAAAAAERVVUUEAABEVVVVVQQAAFRVVVVVBAAAQFRVVVUEAAAARFRVVQQAAAAARFVVBAAAAAAAREUAAAAAAABABQAAAAAAAAAAAAAAAAAAAAAAAA==",
27+
"image6": {
28+
"data": "hwQaABEAAAD//////////w8AAAAPAAAAAAAAAA8AAAAP8P//AAAAAA8AAAAP8PDwAAAAAA8AAAAP8P//AAAAAA8AAAAPAAAAAAAAAA8AAAAP8P//AP//Dw8AAAAP8PAAAAAADw8AAAAP8PD/AAAADw8AAAAP8P/wAP//Dw8AAAAPAAAAAAAAAA8AAAAP8P//AP//Dw8AAAAP8PDwAA8PAA8AAAAP8PDwAA8PAA8AAAAPAAAAAP8PAA8AAAAP8P//AAAAAA8AAAAP8PAAAAAAAA8AAAAP8PAAAAAAAA8AAAAP8P//AAAAAA8AAAAPAAAAAAAAAA8AAAAP8P//AAAAAA8AAAAPAPAAAAAAAA8AAAAPAA8PAAAAAA8AAAAP8ADwAAAAAA8AAAAPAAAAAAAAAA8AAAD//////////w8AAAA=",
29+
"mimeType": "image/x-mkcd-f4",
30+
"displayName": "image8"
31+
},
2832
"anim4": {
2933
"namespace": "myAnimations",
3034
"id": "anim4",

images.g.ts

Lines changed: 19 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -194,23 +194,25 @@ dddd....555555ddd.............
194194
..............................
195195
..............................
196196
`;
197-
case "image6":return img`
198-
. . . . . . . . . . . . . . . .
199-
. . . . . . . . . . . . . . . .
200-
. . . . . . . 4 4 . . . . . . .
201-
. . . . . . . 4 5 4 . . . . . .
202-
. . . . . . 4 5 5 4 4 . . . . .
203-
. . . . . 4 4 5 5 5 4 . . . . .
204-
. . . . 4 4 5 5 5 5 4 4 . . . .
205-
. . . 4 4 5 5 5 5 5 5 4 . . . .
206-
. . . 4 5 5 5 5 5 5 5 5 4 . . .
207-
. . . 4 5 5 5 5 5 5 5 5 4 4 . .
208-
. . . 4 4 5 5 5 5 5 5 5 5 5 . .
209-
. . . . 4 4 4 5 5 5 5 5 4 . . .
210-
. . . . . . 4 4 4 4 4 4 . . . .
211-
. . . . . . . . . . . . . . . .
212-
. . . . . . . . . . . . . . . .
213-
. . . . . . . . . . . . . . . .
197+
case "image6":
198+
case "image8":return img`
199+
ffffffffffffffffffffffffff
200+
f........................f
201+
f........................f
202+
f.fff.ffff.fff.ffff.f..f.f
203+
f.f.f.f..f.f...f..f.f.f..f
204+
f.fff.ffff.fff.ffff.ff...f
205+
f.f.f.f.f..f...f..f.f.f..f
206+
f.fff.f.ff.fff.f..f.f..f.f
207+
f........................f
208+
f........................f
209+
f.....f..f.ffff..........f
210+
f.....f..f.f..f..........f
211+
f.....f..f.ffff..........f
212+
f.....f..f.f.............f
213+
f.....ffff.f.............f
214+
f........................f
215+
ffffffffffffffffffffffffff
214216
`;
215217
}
216218
return null;

main.blocks

Lines changed: 1 addition & 1 deletion
Large diffs are not rendered by default.

main.py

Lines changed: 12 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -8,16 +8,17 @@ def on_up_pressed():
88
jumpcount += 2
99
controller.up.on_event(ControllerButtonEvent.PRESSED, on_up_pressed)
1010

11-
def on_overlap_tile(sprite, location):
12-
game.over(True)
13-
scene.on_overlap_tile(SpriteKind.player, sprites.builtin.brick, on_overlap_tile)
14-
15-
def on_on_overlap(sprite, otherSprite):
11+
def on_on_overlap(sprite, coll1):
1612
coll1.destroy()
1713
info.change_life_by(-1)
1814
sprites.on_overlap(SpriteKind.player, SpriteKind.projectile, on_on_overlap)
1915

16+
def on_overlap_tile(sprite, location):
17+
game.over(True)
18+
scene.on_overlap_tile(SpriteKind.player, sprites.builtin.brick, on_overlap_tile)
19+
2020
def on_life_zero():
21+
info.set_score(0)
2122
game.over(False, effects.confetti)
2223
info.on_life_zero(on_life_zero)
2324

@@ -32,14 +33,18 @@ def on_hit_wall(sprite, location):
3233
tiles.set_tilemap(tilemap("""
3334
level4
3435
"""))
35-
info.set_score(0)
36+
info.set_score(1000)
3637
jack = sprites.create(assets.image("""
3738
image6
3839
"""), SpriteKind.player)
3940
controller.move_sprite(jack, 100, 0)
4041
info.set_life(3)
4142
jack.ay = 250
4243
scene.camera_follow_sprite(jack)
44+
statusbar = statusbars.create(20, 4, StatusBarKind.energy)
45+
statusbar.value = 10
46+
statusbar.position_direction(CollisionDirection.LEFT)
47+
statusbar.set_offset_padding(-40, 0)
4348
test = sprites.all_of_kind(SpriteKind.player)
4449
info.set_score(1000)
4550

@@ -65,4 +70,5 @@ def on_update_interval():
6570

6671
def on_update_interval2():
6772
info.set_score(info.score() - 5)
73+
game.set_dialog_text_color(0)
6874
game.on_update_interval(1000, on_update_interval2)

main.ts

Lines changed: 9 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -7,13 +7,14 @@ controller.up.onEvent(ControllerButtonEvent.Pressed, function () {
77
jumpcount += 2
88
}
99
})
10+
sprites.onOverlap(SpriteKind.Player, SpriteKind.Projectile, function (sprite, coll1) {
11+
coll1.destroy()
12+
info.changeLifeBy(-1)
13+
statusbar.value += -30
14+
})
1015
scene.onOverlapTile(SpriteKind.Player, sprites.builtin.brick, function (sprite, location) {
1116
game.over(true)
1217
})
13-
sprites.onOverlap(SpriteKind.Player, SpriteKind.Projectile, function (sprite, otherSprite) {
14-
otherSprite.destroy()
15-
info.changeLifeBy(-1)
16-
})
1718
info.onLifeZero(function () {
1819
info.setScore(0)
1920
game.over(false, effects.confetti)
@@ -23,6 +24,7 @@ scene.onHitWall(SpriteKind.Projectile, function (sprite, location) {
2324
})
2425
let coll1: Sprite = null
2526
let jumpcount = 0
27+
let statusbar: StatusBarSprite = null
2628
let jack: Sprite = null
2729
scene.setBackgroundColor(9)
2830
tiles.setTilemap(tilemap`level4`)
@@ -32,8 +34,8 @@ controller.moveSprite(jack, 100, 0)
3234
info.setLife(3)
3335
jack.ay = 250
3436
scene.cameraFollowSprite(jack)
35-
let statusbar = statusbars.create(20, 4, StatusBarKind.Energy)
36-
statusbar.value = 10
37+
statusbar = statusbars.create(20, 4, StatusBarKind.Energy)
38+
statusbar.value = 100
3739
statusbar.positionDirection(CollisionDirection.Left)
3840
statusbar.setOffsetPadding(-40, 0)
3941
let test = sprites.allOfKind(SpriteKind.Player)
@@ -53,4 +55,5 @@ game.onUpdateInterval(2000, function () {
5355
})
5456
game.onUpdateInterval(1000, function () {
5557
info.setScore(info.score() - 5)
58+
game.setDialogTextColor(0)
5659
})

0 commit comments

Comments
 (0)