diff options
author | June McEnroe <june@causal.agency> | 2021-01-29 14:08:16 -0500 |
---|---|---|
committer | June McEnroe <june@causal.agency> | 2021-01-29 14:08:16 -0500 |
commit | 46e2bea5d8bd74b30fbf4ba84ef04732b79b8628 (patch) | |
tree | 774623d7106db137b49e60d95d94e1bfad2d117d | |
parent | Give the snake a tail (diff) | |
download | play-46e2bea5d8bd74b30fbf4ba84ef04732b79b8628.tar.gz play-46e2bea5d8bd74b30fbf4ba84ef04732b79b8628.zip |
Actually wait for a non-direction key
Diffstat (limited to '')
-rw-r--r-- | snake.c | 7 |
1 files changed, 6 insertions, 1 deletions
diff --git a/snake.c b/snake.c index 62f660f..1437deb 100644 --- a/snake.c +++ b/snake.c @@ -205,7 +205,12 @@ uint playSnake(void) { draw(); while (ERR != getch()); nodelay(stdscr, false); - getch(); + int ch; + do { + ch = getch(); + } while ( + ch == KEY_LEFT || ch == KEY_DOWN || ch == KEY_UP || ch == KEY_RIGHT + ); return score; } |