From d2f8a3b62331793bc5b71e5c67f8c5b23644c7d2 Mon Sep 17 00:00:00 2001 From: Yohann D'ANELLO Date: Fri, 16 Oct 2020 15:32:15 +0200 Subject: [PATCH] Also use arrow keys in example --- dungeonbattle/proof_of_concept.py | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/dungeonbattle/proof_of_concept.py b/dungeonbattle/proof_of_concept.py index 8fe75c1..046d687 100644 --- a/dungeonbattle/proof_of_concept.py +++ b/dungeonbattle/proof_of_concept.py @@ -23,17 +23,17 @@ def proof_of_concept() -> None: while True: key = stdscr.getkey() 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]] != '#': cur[0] = cur[0] - 1 - if key == 's': + if key == 's' or key == 'KEY_DOWN': if cur[0] < len(matrix) - 1 and \ matrix[cur[0] + 1][cur[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] != '#': cur[1] = cur[1] - 1 - if key == 'd': + if key == 'd' or key == 'KEY_RIGHT': if cur[1] < len(matrix[0]) and \ matrix[cur[0]][cur[1] + 1] != '#': cur[1] = cur[1] + 1