-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathmain.py
63 lines (58 loc) · 1.61 KB
/
main.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
def on_countdown_end():
game.over(True)
info.on_countdown_end(on_countdown_end)
def on_on_overlap(sprite, otherSprite):
projectile.destroy()
info.change_score_by(1)
sprites.on_overlap(SpriteKind.player, SpriteKind.projectile, on_on_overlap)
def on_on_overlap2(sprite2, otherSprite2):
projectile2.destroy()
info.change_life_by(-1)
sprites.on_overlap(SpriteKind.player, SpriteKind.enemy, on_on_overlap2)
projectile2: Sprite = None
projectile: Sprite = None
scene.set_background_image(assets.image("""
Freeway
"""))
mySprite = sprites.create(assets.image("""
Mama
"""), SpriteKind.player)
controller.move_sprite(mySprite, 0, 100)
mySprite.set_stay_in_screen(True)
scroller.scroll_background_with_speed(-50, 0)
info.start_countdown(15)
animation.run_image_animation(mySprite,
assets.animation("""
Mama Moving
"""),
100,
True)
def on_forever():
global projectile2
projectile2 = sprites.create_projectile_from_side(assets.image("""
Tourist
"""), -90, 0)
projectile2.y = randint(15, 115)
projectile2.set_kind(SpriteKind.enemy)
animation.run_image_animation(projectile2,
assets.animation("""
Animated Tourist
"""),
100,
True)
pause(2100)
forever(on_forever)
def on_forever2():
global projectile
projectile = sprites.create_projectile_from_side(assets.image("""
Baby
"""), -90, 0)
projectile.y = randint(15, 100)
animation.run_image_animation(projectile,
assets.animation("""
Animated Baby
"""),
100,
True)
pause(1000)
forever(on_forever2)