Also use arrow keys in example
This commit is contained in:
parent
ef6e5d66ca
commit
c8de541eee
|
@ -23,17 +23,17 @@ def proof_of_concept() -> None:
|
||||||
while True:
|
while True:
|
||||||
key = stdscr.getkey()
|
key = stdscr.getkey()
|
||||||
stdscr.addstr(cur[0], cur[1], '.')
|
stdscr.addstr(cur[0], cur[1], '.')
|
||||||
if key == 'z':
|
if key == 'z' or key == 'KEY_UP':
|
||||||
if cur[0] > 0 and matrix[cur[0] - 1][cur[1]] != '#':
|
if cur[0] > 0 and matrix[cur[0] - 1][cur[1]] != '#':
|
||||||
cur[0] = cur[0] - 1
|
cur[0] = cur[0] - 1
|
||||||
if key == 's':
|
if key == 's' or key == 'KEY_DOWN':
|
||||||
if cur[0] < len(matrix) - 1 and \
|
if cur[0] < len(matrix) - 1 and \
|
||||||
matrix[cur[0] + 1][cur[1]] != '#':
|
matrix[cur[0] + 1][cur[1]] != '#':
|
||||||
cur[0] = cur[0] + 1
|
cur[0] = cur[0] + 1
|
||||||
if key == 'q':
|
if key == 'q' or key == 'KEY_LEFT':
|
||||||
if cur[1] > 0 and matrix[cur[0]][cur[1] - 1] != '#':
|
if cur[1] > 0 and matrix[cur[0]][cur[1] - 1] != '#':
|
||||||
cur[1] = cur[1] - 1
|
cur[1] = cur[1] - 1
|
||||||
if key == 'd':
|
if key == 'd' or key == 'KEY_RIGHT':
|
||||||
if cur[1] < len(matrix[0]) and \
|
if cur[1] < len(matrix[0]) and \
|
||||||
matrix[cur[0]][cur[1] + 1] != '#':
|
matrix[cur[0]][cur[1] + 1] != '#':
|
||||||
cur[1] = cur[1] + 1
|
cur[1] = cur[1] + 1
|
||||||
|
|
Loading…
Reference in New Issue