Skip to content

Commit fe4fbd8

Browse files
committed
Initial experiments for a gauntlet game
1 parent e866c51 commit fe4fbd8

File tree

1 file changed

+31
-0
lines changed

1 file changed

+31
-0
lines changed

examples/gauntlet_game/main.py

Lines changed: 31 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,31 @@
1+
import board
2+
import dotstar_featherwing
3+
import time
4+
import random
5+
6+
wing = dotstar_featherwing.DotstarFeatherwing(board.D13, board.D11)
7+
8+
wing.clear()
9+
wing.show()
10+
11+
black = (0, 0, 0)
12+
background = (32, 8, 0)
13+
edge = (32, 32, 0)
14+
blue = (0, 0, 64)
15+
16+
row = (background, background, background, background, background, background, background, edge, black, black, black, black, black, edge, background, background, background, background, background, background, background)
17+
18+
19+
for i in range(wing.rows):
20+
wing.shift_into_top(row, 4)
21+
wing.show()
22+
23+
offset = 4
24+
while True:
25+
offset = min(max(0, offset + random.randint(-1, 1)), 9)
26+
wing.shift_into_top(row, offset)
27+
if random.randint(1, 10) == 1:
28+
pos = random.randint(8, 12) - offset
29+
wing.set_color(0, pos, blue)
30+
wing.show()
31+
time.sleep(0.1)

0 commit comments

Comments
 (0)