-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathmain.py
54 lines (50 loc) · 1.29 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
button = 0
delay = 0
def on_button_pressed_a():
if button != 0:
game.game_over()
game.resume()
input.on_button_pressed(Button.A, on_button_pressed_a)
def on_button_pressed_ab():
if button != 2:
game.game_over()
game.resume()
input.on_button_pressed(Button.AB, on_button_pressed_ab)
def on_button_pressed_b():
if button != 1:
game.game_over()
game.resume()
input.on_button_pressed(Button.B, on_button_pressed_b)
def on_forever():
global delay, button
delay = randint(500, 2000)
button = randint(0, 2)
if game.is_running():
basic.pause(delay)
if button == 0:
basic.show_leds("""
# # # . .
# # # . .
# # # . .
# # # . .
# # # . .
""")
elif button == 1:
basic.show_leds("""
. . # # #
. . # # #
. . # # #
. . # # #
. . # # #
""")
else:
basic.show_leds("""
# # # # #
# # # # #
# # # # #
# # # # #
# # # # #
""")
basic.pause(100)
game.start_countdown(1000)
basic.forever(on_forever)