-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathexplode.py
More file actions
169 lines (146 loc) · 20.6 KB
/
Copy pathexplode.py
File metadata and controls
169 lines (146 loc) · 20.6 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
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
from machine import Pin, I2C
from ssd1306 import SSD1306_I2C
from random import randint
from utime import sleep_ms
import framebuf, sys
import utime
# bitmaps
START_SCREEN_BMAP = bytearray(b'\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\xe92^\x1d&K\xc4\xe4\xa1\xe7\x00\x00\x00\x00\x00\x01\tz\x90!/R\x04\xf4\xa1\x08 \x00\x00\x00\x00\x00\xcf{\x1c\x19\xefc\x84\xe4\xa1\xc6\x00\x00\x00\x00\x00\x00)J\x90\x05)R\x04\xa4\xa1\x01 \x00\x00\x00\x00\x01\xc9J^9)K\xc4\x93=\xee\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x04\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x04\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x04\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x04\x00\x00\x00\x00\x00\x00\x00\x00\x00\xfc\x0f\x03\xc3\x03\x0c\x04@\x1d&K\xc7\xd2\xf0\x00\x00\xfc\x0f\x03\xc3\x03\x0c\x04\xc0!)R\x01\x12\x80\x00\x00\xc30\xcc3\xcf\x0c\x04@\x19\xefc\x81\x1e\xe0\x00\x00\xc30\xcc3\xcf\x0c\x04@\x05)R\x01\x12\x80\x00\x00\xfc0\xcc33\x0c\x04\xe49)K\xc1\x12\xf0\x00\x00\xfc0\xcc33\x0c\x04\x00\x00\x00\x00\x00\x00\x00\x00\x00\xc30\xcc3\x03\x00\x04\x008\xcf\xbe\x87\x80\x00\x00\x00\xc30\xcc3\x03\x00\x04\x00%"\x08\x84\x00\x00\x00\x00\xfc\x0f\x03\xc3\x03\x0c\x04\x009"\x08\x87\x00\x00\x00\x00\xfc\x0f\x03\xc3\x03\x0c\x04\x00%"\x08\x84\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x04\x008\xc2\x08\xf7\x80\x00\x00\x00\x00\x00\x00\x00\x00\x00\x04\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x04\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x04\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x04`\x1cd\x93\xe3\xdd\x08\x00\x00\x00\x00\x18\x00\x00\x00\x04\x90\x12\x96\x90\x82\t\x08\x00\x00\x00\x00\x18\x00\x00\x00\x04 \x12\x95\x80\x83\x89\x08\x00\x00\x00\x00\x1c\x01\x00\x00\x04@\x12\x94\x80\x82\t\x08\x00\x00\x00`\x1c\x07\x00\x00\x04\xf2\x1cd\x80\x82\x1d\xef\x00\x00\x00p\x1e?\x00\x00\x04\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00x\x1f\xfe\x00\x00\x04\x00>\x97\x873\x9e\xf4\x80\x00\x00~\x1d\xfe\x00\x00\x04\x00\x08\x94\x08K\xd0\x86\x80\x00\x00c<\xfe\x00\x00\x04\x00\x08\xf7\x06C\x9c\xe5\x80\x00\x000\xf8\xfc\x00\x00\x04\x00\x08\x94\x01J\x90\x84\x80\x00\x008x\xfe\x00\x00\x04\x00\x08\x97\x8e2^\xf4\x80\x00\x008\x18p\xc0\x00\x04\x00\x00\x00\x00\x00\x00\x00\x00\x0e\x00<\x08`\xf8\x0e\x04\x00"\xef\xa4\x00\x00\x00\x00\x11\x00\x7f\x00\x01\xfc\x11\x04\x00"B$\x00\x00\x00\x00\x11\x00\xff\x00\x01\xf0\x11\x04\x00*B<\x00\x008\x00\x11\x01\xff\x00\x03\x80\x11\x04\x006B$\x00\x00D\x00\x11\x03\xfe\x00\x02\x00\x11\x04\x00"\xe2$\x00\x00D\x00\x11\x07\xfc\x00\x07\x00\x0e\x04\x00\x00\x00\x00\x00\x00D\x00\x0e\x07\xf8\x00\x06\x00\x00\x04\x009.r\x1epD\x00\x00\x0f\xf8\x00\x04\x00\x04\x04\x00%)J\x10\x808\x00\x0e\x00\n\x00\x02\x00\n\x04\x009.r\x1c`\x008\x11\x00\x15\xc0\x01\x00\x11\x04\x00%)J\x10\x10\x00D\x11\x00\x19\xe1\xff\x80\x11\x04\x008\xces\xde\xe0\x00D\x11\x00\x01\xe2\x00\x80\x11\x04\x00\x00\x00\x00\x00\x00\x00D\x11\x00\x01\xe4\x00\x00\x11\x04\x00\x00\x00\x00\x00\x00\x00D\x11\x00\x00\xf8\x00\x00\x11\x04\x00\x00\x00\x00\x00\x00\x008\x11\x00\x00\xc0\x00\x00\x00\x04\x00\x00\x00\x00\x00\x00\x1c\x00\x00\x00\x00\x80\x00\x00\x00\x04\x00\x00\x00\x00\x00\x00"\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00"\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00"\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00"\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x1c\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00')
PAUSE_SCREEN_BMAP = bytearray(b'\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x7f\xc0\x03\xfe\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x7f\xc0\x03\xfe\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x7f\xc0\x03\xfe\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x7f\xc0\x03\xfe\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x7f\xc0\x03\xfe\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x7f\xc0\x03\xfe\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x7f\xc0\x03\xfe\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x7f\xc0\x03\xfe\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x7f\xc0\x03\xfe\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x7f\xc0\x03\xfe\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x7f\xc0\x03\xfe\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x7f\xc0\x03\xfe\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x7f\xc0\x03\xfe\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x7f\xc0\x03\xfe\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x7f\xc0\x03\xfe\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x7f\xc0\x03\xfe\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x7f\xc0\x03\xfe\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x7f\xc0\x03\xfe\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x7f\xc0\x03\xfe\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x7f\xc0\x03\xfe\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x7f\xc0\x03\xfe\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x7f\xc0\x03\xfe\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x7f\xc0\x03\xfe\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x7f\xc0\x03\xfe\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x7f\xc0\x03\xfe\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x7f\xc0\x03\xfe\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x7f\xc0\x03\xfe\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x7f\xc0\x03\xfe\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x7f\xc0\x03\xfe\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x7f\xc0\x03\xfe\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x7f\xc0\x03\xfe\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x7f\xc0\x03\xfe\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x7f\xc0\x03\xfe\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x7f\xc0\x03\xfe\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x7f\xc0\x03\xfe\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x7f\xc0\x03\xfe\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x7f\xc0\x03\xfe\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x7f\xc0\x03\xfe\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x7f\xc0\x03\xfe\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x7f\xc0\x03\xfe\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x7f\xc0\x03\xfe\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00')
EXPLOSION_BMAP_1 = bytearray(b'\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\xf8\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\xf8\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\xf8\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\xf8\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\xff\x00\x00\x03\x80\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\xff\x00\x00\x03\x80\x00\x00\x00\x00\x00\x00\x00\x01\xf0\x00\x00\xff\x00\x00\x7f\x80\x00\x00\x00\x00\x00\x00\x00\x01\xf0\x00\x00\xff\x00\x00\x7f\x80\x00\x00\x00\x00\x00\x00\x00\x01\xfe\x00\x00\xff\xc0?\xff\x80\x00\x00\x00\x00\x00\x00\x00\x01\xfe\x00\x00\xff\xc0?\xff\x80\x00\x00\x00\x00\x00\x00\x00\x01\xff\x80\x00\xff\xff\xff\xfc\x00\x00\x00\x00\x00\x00\x00\x00\x01\xff\x80\x00\xff\xff\xff\xfc\x00\x00\x00\x00\x00\x00\x00\x00\x01\xff\xfc\x00\xff?\xff\xfc\x00\x00\x00\x00\x00\x00\x00\x00\x01\xff\xfc\x00\xff?\xff\xfc\x00\x00\x00\x00\x00\x00\x00\x00\x01\xf0\x0f\x83\xff\x07\xff\xfc\x00\x00\x00\x00\x00\x00\x00\x00\x01\xf0\x0f\x83\xff\x07\xff\xfc\x00\x00\x00\x00\x00\x00\x00\x00\x01\xf0\x0f\x83\xff\x07\xff\xfc\x00\x00\x00\x00\x00\x00\x00\x00\x00>\x00\x7f\xf8\x07\xff\xf0\x00\x00\x00\x00\x00\x00\x00\x00\x00>\x00\x7f\xf8\x07\xff\xf0\x00\x00\x00\x00\x00\x00\x00\x00\x00?\x80\x1f\xf8\x07\xff\xfc\x00\x00\x00\x00\x00\x00\x00\x00\x00?\x80\x1f\xf8\x07\xff\xfc\x00\x00\x00\x00\x00\x00\x00\x00\x00?\x80\x00\xf8\x01\xfe\x00|\x00\x00\x00\x00\x00\x00\x00\x00?\x80\x00\xf8\x01\xfe\x00|\x00\x00\x00\x00\x00\x00\x00\x00?\xf0\x00\x18\x01\xf0\x00\x7f\xf8\x00\x00\x00\x00\x00\x00\x00?\xf0\x00\x18\x01\xf0\x00\x7f\xf8\x00\x00\x00\x00\x00\x00\x01\xff\xff\x80\x00\x00\x00\x03\xff\xff\x00\x00\x00\x00\x00\x00\x01\xff\xff\x80\x00\x00\x00\x03\xff\xff\x00\x00\x00\x00\x00\x00\x07\xff\xff\x80\x00\x00\x00\x03\xff\xe0\x00\x00\x00\x00\x00\x00\x07\xff\xff\x80\x00\x00\x00\x03\xff\xe0\x00\x00\x00\x00\x00\x00?\xff\xff\x80\x00\x00\x00\x0f\xe0\x00\x00\x00\x00\x00\x00\x00?\xff\xff\x80\x00\x00\x00\x0f\xe0\x00\x00\x00\x00\x00\x00\x00\xff\xff\xfc\x00\x00\x00\x00\x0c\x00\x00\x00\x00\x00\x00\x00\x00\xff\xff\xfc\x00\x00\x00\x00\x0c\x00\x00\x00\x00\x00\x00\x00\x07\xff\xff\xf0\x00\x00\x00\x00\x7f\x80\x00\x00\x00\x00\x00\x00\x07\xff\xff\xf0\x00\x00\x00\x00\x7f\x80\x00\x00\x00\x00\x00\x00\x07\xff\xff\x80\x00\x00\x00\x00|\x00\x00\x00\x00\x00\x00\x00\x07\xff\xff\x80\x00\x00\x00\x00|\x00\x00\x00\x00\x00\x00\x00\x1f\xff\xff\x80\x00\x00\x00\x00p\x00\x00\x00\x00\x00\x00\x00\x1f\xff\xff\x80\x00\x00\x00\x00p\x00\x00\x00\x00\x00\x00\x00\x00\x00\x01\x8c\x00\x00\x00\x00\x0c\x00\x00\x00\x00\x00\x00\x00\x00\x00\x01\x8c\x00\x00\x00\x00\x0c\x00\x00\x00\x00\x00\x00\x00\x00\x00\x0es\xfc\x00\x00\x00\x03\x80\x00\x00\x00\x00\x00\x00\x00\x00\x0es\xfc\x00\x00\x00\x03\x80\x00\x00\x00\x00\x00\x00\x00\x00\x0f\x83\xff\x00?\xff\xff\xe0\x00\x00\x00\x00\x00\x00\x00\x00\x0f\x83\xff\x00?\xff\xff\xe0\x00\x00\x00\x00\x00\x00\x00\x00\x0f\x83\xff\x00?\xff\xff\xe0\x00\x00\x00\x00\x00\x00\x00\x00\x00\x03\xff\x00\xc0\x00\x00`\x00\x00\x00\x00\x00\x00\x00\x00\x00\x03\xff\x00\xc0\x00\x00`\x00\x00\x00\x00\x00\x00\x00\x00\x00\x03\xff\x07\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x03\xff\x07\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x7f\xf8\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x7f\xf8\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00|\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00|\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00`\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00`\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00')
EXPLOSION_BMAP_2 = bytearray(b'\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\x07\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\x07\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\x07\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\x07\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\x00\xff\xff\xfc\x7f\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\x00\xff\xff\xfc\x7f\xff\xff\xff\xff\xff\xff\xff\xfe\x0f\xff\xff\x00\xff\xff\x80\x7f\xff\xff\xff\xff\xff\xff\xff\xfe\x0f\xff\xff\x00\xff\xff\x80\x7f\xff\xff\xff\xff\xff\xff\xff\xfe\x01\xff\xff\x00?\xc0\x00\x7f\xff\xff\xff\xff\xff\xff\xff\xfe\x01\xff\xff\x00?\xc0\x00\x7f\xff\xff\xff\xff\xff\xff\xff\xfe\x00\x7f\xff\x00\x00\x00\x03\xff\xff\xff\xff\xff\xff\xff\xff\xfe\x00\x7f\xff\x00\x00\x00\x03\xff\xff\xff\xff\xff\xff\xff\xff\xfe\x00\x03\xff\x00\xc0\x00\x03\xff\xff\xff\xff\xff\xff\xff\xff\xfe\x00\x03\xff\x00\xc0\x00\x03\xff\xff\xff\xff\xff\xff\xff\xff\xfe\x0f\xf0|\x00\xf8\x00\x03\xff\xff\xff\xff\xff\xff\xff\xff\xfe\x0f\xf0|\x00\xf8\x00\x03\xff\xff\xff\xff\xff\xff\xff\xff\xfe\x0f\xf0|\x00\xf8\x00\x03\xff\xff\xff\xff\xff\xff\xff\xff\xff\xc1\xff\x80\x07\xf8\x00\x0f\xff\xff\xff\xff\xff\xff\xff\xff\xff\xc1\xff\x80\x07\xf8\x00\x0f\xff\xff\xff\xff\xff\xff\xff\xff\xff\xc0\x7f\xe0\x07\xf8\x00\x03\xff\xff\xff\xff\xff\xff\xff\xff\xff\xc0\x7f\xe0\x07\xf8\x00\x03\xff\xff\xff\xff\xff\xff\xff\xff\xff\xc0\x7f\xff\x07\xfe\x01\xff\x83\xff\xff\xff\xff\xff\xff\xff\xff\xc0\x7f\xff\x07\xfe\x01\xff\x83\xff\xff\xff\xff\xff\xff\xff\xff\xc0\x0f\xff\xe7\xfe\x0f\xff\x80\x07\xff\xff\xff\xff\xff\xff\xff\xc0\x0f\xff\xe7\xfe\x0f\xff\x80\x07\xff\xff\xff\xff\xff\xff\xfe\x00\x00\x7f\xff\xff\xff\xfc\x00\x00\xff\xff\xff\xff\xff\xff\xfe\x00\x00\x7f\xff\xff\xff\xfc\x00\x00\xff\xff\xff\xff\xff\xff\xf8\x00\x00\x7f\xff\xff\xff\xfc\x00\x1f\xff\xff\xff\xff\xff\xff\xf8\x00\x00\x7f\xff\xff\xff\xfc\x00\x1f\xff\xff\xff\xff\xff\xff\xc0\x00\x00\x7f\xff\xff\xff\xf0\x1f\xff\xff\xff\xff\xff\xff\xff\xc0\x00\x00\x7f\xff\xff\xff\xf0\x1f\xff\xff\xff\xff\xff\xff\xff\x00\x00\x03\xff\xff\xff\xff\xf3\xff\xff\xff\xff\xff\xff\xff\xff\x00\x00\x03\xff\xff\xff\xff\xf3\xff\xff\xff\xff\xff\xff\xff\xf8\x00\x00\x0f\xff\xff\xff\xff\x80\x7f\xff\xff\xff\xff\xff\xff\xf8\x00\x00\x0f\xff\xff\xff\xff\x80\x7f\xff\xff\xff\xff\xff\xff\xf8\x00\x00\x7f\xff\xff\xff\xff\x83\xff\xff\xff\xff\xff\xff\xff\xf8\x00\x00\x7f\xff\xff\xff\xff\x83\xff\xff\xff\xff\xff\xff\xff\xe0\x00\x00\x7f\xff\xff\xff\xff\x8f\xff\xff\xff\xff\xff\xff\xff\xe0\x00\x00\x7f\xff\xff\xff\xff\x8f\xff\xff\xff\xff\xff\xff\xff\xff\xff\xfes\xff\xff\xff\xff\xf3\xff\xff\xff\xff\xff\xff\xff\xff\xff\xfes\xff\xff\xff\xff\xf3\xff\xff\xff\xff\xff\xff\xff\xff\xff\xf1\x8c\x03\xff\xff\xff\xfc\x7f\xff\xff\xff\xff\xff\xff\xff\xff\xf1\x8c\x03\xff\xff\xff\xfc\x7f\xff\xff\xff\xff\xff\xff\xff\xff\xf0|\x00\xff\xc0\x00\x00\x1f\xff\xff\xff\xff\xff\xff\xff\xff\xf0|\x00\xff\xc0\x00\x00\x1f\xff\xff\xff\xff\xff\xff\xff\xff\xf0|\x00\xff\xc0\x00\x00\x1f\xff\xff\xff\xff\xff\xff\xff\xff\xff\xfc\x00\xff?\xff\xff\x9f\xff\xff\xff\xff\xff\xff\xff\xff\xff\xfc\x00\xff?\xff\xff\x9f\xff\xff\xff\xff\xff\xff\xff\xff\xff\xfc\x00\xf8\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xfc\x00\xf8\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\x80\x07\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\x80\x07\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\x83\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\x83\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\x9f\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\x9f\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff')
# pins
GATE_PIN = 6
PEDOMETER_PIN = 17
OLED_SDA_PIN = 26
OLED_SCL_PIN = 27
BTN_PIN = 15
# constants
EXPLODE_TIME = 2000 # ms
SHAKES_MIN = 20
SHAKES_MAX = 40
BUBBLE_X_MIN = 1
BUBBLE_X_MAX = 121
BUBBLE_Y_MIN = 1
BUBBLE_Y_MAX = 57
STARTING_BUBBLES = 3
BUBBLES_PER_SHAKE = 1
RESET_HOLD_TIME = 3000 # ms
def reset_shakes_needed():
new_shakes_needed = randint(SHAKES_MIN, SHAKES_MAX)
print(new_shakes_needed)
return new_shakes_needed
def clamp(val, minval, maxval):
if val < minval: return minval
if val > maxval: return maxval
return val
def draw_bubble_at(display, x, y):
display.hline(x+2, y, 4, 1)
display.hline(x+2, y+7, 4, 1)
display.vline(x, y+2, 4, 1)
display.vline(x+7, y+2, 4, 1)
display.pixel(x+1, y+1, 1)
display.pixel(x+1, y+6, 1)
display.pixel(x+6, y+1, 1)
display.pixel(x+6, y+6, 1)
display.pixel(x+3, y+2, 1)
display.pixel(x+2, y+3, 1)
def draw_bubbles(display, bubbles):
display.fill(0)
for b in bubbles:
draw_bubble_at(display, b[0], b[1])
display.show()
def add_bubbles(bubbles, n=1):
new_bubbles = bubbles
for i in range(n):
new_bubbles.append((randint(BUBBLE_X_MIN, BUBBLE_X_MAX), randint(BUBBLE_Y_MIN, BUBBLE_Y_MAX)))
return new_bubbles
def animate_bubbles(bubbles):
new_bubbles = [(clamp(b[0]+randint(-1,1), BUBBLE_X_MIN, BUBBLE_X_MAX),
clamp(b[1]+randint(-1,1), BUBBLE_Y_MIN, BUBBLE_Y_MAX)) for b in bubbles]
return new_bubbles
def draw_buf(display, buf, width=128, height=64, x=0, y=0):
fb = framebuf.FrameBuffer(buf, width, height, framebuf.MONO_HLSB)
display.fill(0)
display.blit(fb, x, y)
display.show()
def main():
# pin setup
print("WHY NOT ")
gate = Pin(GATE_PIN, Pin.OUT)
pdmet = Pin(PEDOMETER_PIN, Pin.IN, Pin.PULL_UP)
btn = Pin(BTN_PIN, Pin.IN, Pin.PULL_UP)
i2c_dev = I2C(1, scl=Pin(OLED_SCL_PIN), sda=Pin(OLED_SDA_PIN), freq=200000)
oled = SSD1306_I2C(128, 64, i2c_dev)
# states
pdmet_state = pdmet.value()
last_pdmet_state = pdmet_state
paused = False
is_started = False
# setup
bubbles = []
gate.value(0)
btn_last = btn.value()
shakes_needed = reset_shakes_needed()
num_shakes = 0
start_time = utime.ticks_ms()
bubbles = add_bubbles(bubbles, n=STARTING_BUBBLES)
while True:
if not is_started:
btn_val = btn.value()
if btn_val != btn_last:
if btn_val == 0:
is_started = True
btn_last = btn_val
draw_buf(oled, START_SCREEN_BMAP)
else:
btn_val = btn.value()
if btn_val != btn_last:
if btn_val == 0:
paused = not paused
start_time = utime.ticks_ms()
btn_last = btn_val
if paused:
oled.fill(0)
if btn_val == 0:
elapsed_time_ms = utime.ticks_diff(utime.ticks_ms(), start_time)
if elapsed_time_ms > 1000:
oled.text("RESET GAME IN", 0, 20)
oled.text(str(((RESET_HOLD_TIME - elapsed_time_ms) // 1000) + 1), 0, 40)
if elapsed_time_ms > RESET_HOLD_TIME:
oled.fill(0)
num_shakes = 0
bubbles = add_bubbles([], n=STARTING_BUBBLES)
shakes_needed = reset_shakes_needed()
oled.text("RESETTING GAME!", 0, 0)
paused = False
is_started = False
else:
draw_buf(oled, PAUSE_SCREEN_BMAP)
oled.show()
else:
bubbles = animate_bubbles(bubbles)
draw_bubbles(oled, bubbles)
pdmet_state = pdmet.value()
if pdmet_state != last_pdmet_state:
if pdmet_state == 0:
num_shakes += 1
add_bubbles(bubbles, n=BUBBLES_PER_SHAKE)
last_pdmet_state = pdmet_state
if num_shakes >= shakes_needed:
gate.value(1)
draw_buf(oled, EXPLOSION_BMAP_1)
sleep_ms(EXPLODE_TIME // 4)
draw_buf(oled, EXPLOSION_BMAP_2)
sleep_ms(EXPLODE_TIME // 4)
draw_buf(oled, EXPLOSION_BMAP_1)
sleep_ms(EXPLODE_TIME // 4)
draw_buf(oled, EXPLOSION_BMAP_2)
sleep_ms(EXPLODE_TIME // 4)
gate.value(0)
num_shakes = 0
bubbles = add_bubbles([], n=STARTING_BUBBLES)
shakes_needed = reset_shakes_needed()
is_started = False
if __name__ == '__main__':
main()