-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathmain.py
More file actions
142 lines (132 loc) · 3.87 KB
/
Copy pathmain.py
File metadata and controls
142 lines (132 loc) · 3.87 KB
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
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
@namespace
class SpriteKind:
pet = SpriteKind.create()
vehichle = SpriteKind.create()
def on_overlap_tile(sprite, location):
tiles.set_tile_at(location, sprites.dungeon.floor_dark2)
music.ba_ding.play()
info.start_countdown(10)
scene.on_overlap_tile(SpriteKind.player,
assets.tile("""
myTile0
"""),
on_overlap_tile)
def on_overlap_tile2(sprite, location):
global winning_points
if key == 3:
Riley.destroy()
scene.set_background_color(1)
tiles.set_tilemap(tilemap("""
level9
"""))
winning_points += 1
info.stop_countdown()
else:
game.splash("door is locked")
if winning_points2 == 1:
game.splash("press the spacebar to continue")
scene.on_overlap_tile(SpriteKind.player,
sprites.dungeon.door_locked_north,
on_overlap_tile2)
def on_overlap_tile3(sprite, location):
global key, winning_points2
if key == 2:
music.small_crash.play()
tiles.set_tilemap(tilemap("""
level8
"""))
tiles.place_on_random_tile(Riley, sprites.dungeon.stair_east)
key = 0
winning_points2 = 0
info.start_countdown(10)
else:
game.splash("door is locked")
scene.on_overlap_tile(SpriteKind.player,
sprites.dungeon.door_closed_east,
on_overlap_tile3)
def on_b_pressed():
if losing_points == 1:
game.over(False)
controller.B.on_event(ControllerButtonEvent.PRESSED, on_b_pressed)
def on_a_pressed():
if winning_points == 1:
game.over(True)
controller.A.on_event(ControllerButtonEvent.PRESSED, on_a_pressed)
def on_countdown_end():
global losing_points
music.stop_all_sounds()
scene.set_background_color(15)
tiles.set_tilemap(tilemap("""
level2
"""))
tiles.place_on_random_tile(Riley, assets.tile("""
transparency16
"""))
Riley.destroy()
scene.camera_shake(4, 2000)
losing_points += 1
info.on_countdown_end(on_countdown_end)
def on_overlap_tile4(sprite, location):
global key
if key == 2:
music.small_crash.play()
tiles.set_tilemap(tilemap("""
level7
"""))
tiles.place_on_random_tile(Riley, sprites.dungeon.stair_south)
key = 0
info.start_countdown(10)
else:
game.splash("door is locked")
scene.on_overlap_tile(SpriteKind.player,
sprites.dungeon.door_closed_south,
on_overlap_tile4)
def on_overlap_tile5(sprite, location):
global key
tiles.set_tile_at(location, sprites.dungeon.floor_dark2)
key += 1
music.beam_up.play()
scene.on_overlap_tile(SpriteKind.player,
assets.tile("""
myTile2
"""),
on_overlap_tile5)
winning_points2 = 0
winning_points = 0
losing_points = 0
key = 0
Riley: Sprite = None
camera_shake = 0
tiles.set_tilemap(tilemap("""
level1
"""))
Riley = sprites.create(img("""
. . . . . . . . . . . . . . . .
. . . . f f f f f f f . . . . .
. . . . f f c c c c d f f . . .
. . f f f f f c c c c d d f . .
. . f f f f f f c c c c d f . .
. . f f f f f f f f f c d f . .
. . f f f e e f f e e f d f . .
. . f f f b 8 4 f 8 b f f f . .
. . f f e 1 9 4 4 9 1 e f f . .
. . . f f 4 4 4 4 4 4 f f . . .
. . . f f f e e e e f f f . . .
. . e e f f 9 9 9 9 f f e e . .
. . e 4 e 9 9 9 9 9 9 e 4 e . .
. . e e e 6 6 6 6 6 6 e e e . .
. . . . . f f f f f f . . . . .
. . . . . f f . . f f . . . . .
"""),
SpriteKind.player)
key = 0
losing_points = 0
winning_points = 0
tiles.place_on_random_tile(Riley, sprites.dungeon.stair_south)
info.set_life(1)
controller.move_sprite(Riley, 100, 100)
scene.camera_follow_sprite(Riley)
info.start_countdown(10)
def on_forever():
music.play_melody("E G D F B A F D ", 320)
forever(on_forever)