Skip to content

Commit b1fec6f

Browse files
committed
Update main.blocks, main.ts, main.py, images.g.jres, images.g.ts
1 parent 4101f75 commit b1fec6f

7 files changed

Lines changed: 1758 additions & 482 deletions

File tree

.github/makecode/blocks.png

34.7 KB
Loading

.github/makecode/blocksdiff.png

73.3 KB
Loading

images.g.jres

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

images.g.ts

Lines changed: 1688 additions & 464 deletions
Large diffs are not rendered by default.

main.blocks

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

main.py

Lines changed: 23 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,20 @@ def on_up_pressed():
66
elif cnt == 1:
77
hacker.vy = -120
88
cnt += 2
9+
if hacker.vx < 0:
10+
animation.run_image_animation(hacker,
11+
assets.animation("""
12+
left jump animation
13+
"""),
14+
300,
15+
False)
16+
else:
17+
animation.run_image_animation(hacker,
18+
assets.animation("""
19+
right jump animation
20+
"""),
21+
300,
22+
False)
923
controller.up.on_event(ControllerButtonEvent.PRESSED, on_up_pressed)
1024

1125
def on_left_pressed():
@@ -20,8 +34,8 @@ def on_right_pressed():
2034
"""))
2135
controller.right.on_event(ControllerButtonEvent.PRESSED, on_right_pressed)
2236

23-
stone: Sprite = None
2437
projectile: Sprite = None
38+
stone: Sprite = None
2539
cnt = 0
2640
hacker: Sprite = None
2741
scene.set_background_image(img("""
@@ -170,17 +184,17 @@ def on_on_update():
170184
game.on_update(on_on_update)
171185

172186
def on_update_interval():
187+
global stone
188+
stone = sprites.create_projectile_from_side(assets.image("""
189+
cactus_img
190+
"""), 0, 55)
191+
stone.x = hacker.x + 5
192+
game.on_update_interval(5000, on_update_interval)
193+
194+
def on_update_interval2():
173195
global projectile
174196
projectile = sprites.create_projectile_from_side(assets.image("""
175197
smartCloud
176198
"""), -19, 0)
177199
projectile.y = 50
178-
game.on_update_interval(5000, on_update_interval)
179-
180-
def on_update_interval2():
181-
global stone
182-
stone = sprites.create_projectile_from_side(assets.image("""
183-
image14
184-
"""), 0, 55)
185-
stone.x = hacker.x + 5
186200
game.on_update_interval(5000, on_update_interval2)

main.ts

Lines changed: 17 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -6,18 +6,30 @@ controller.up.onEvent(ControllerButtonEvent.Pressed, function () {
66
hacker.vy = -120
77
cnt += 2
88
}
9+
if (hacker.vx > 0) {
10+
animation.runImageAnimation(
11+
hacker,
12+
assets.animation`left jump animation`,
13+
200,
14+
false
15+
)
16+
} else {
17+
animation.runImageAnimation(
18+
hacker,
19+
assets.animation`right jump animation`,
20+
200,
21+
false
22+
)
23+
}
924
})
1025
controller.left.onEvent(ControllerButtonEvent.Pressed, function () {
1126
hacker.setImage(assets.image`Temporary asset3`)
1227
})
1328
controller.right.onEvent(ControllerButtonEvent.Pressed, function () {
1429
hacker.setImage(assets.image`Temporary asset2`)
1530
})
16-
scene.onHitWall(SpriteKind.Projectile, function (sprite, location) {
17-
stone.destroy(effects.disintegrate, 200)
18-
})
19-
let projectile: Sprite = null
2031
let stone: Sprite = null
32+
let projectile: Sprite = null
2133
let cnt = 0
2234
let hacker: Sprite = null
2335
scene.setBackgroundImage(img`
@@ -153,7 +165,7 @@ scene.cameraFollowSprite(hacker)
153165
// hacker.vy = 0
154166
game.onUpdate(function () {
155167
if (hacker.y < 50) {
156-
hacker.vy = 30
168+
hacker.vy = 50
157169
hacker.ay = 150
158170
} else if (hacker.y <= 90) {
159171
hacker.ay = 150

0 commit comments

Comments
 (0)