From 8b9fcdd3dfbf38fe27efb4906e9479827265ea19 Mon Sep 17 00:00:00 2001 From: Nakidai Date: Tue, 31 Oct 2023 05:05:10 +0300 Subject: [PATCH] Now player can't turn into itself --- src/main.c | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/src/main.c b/src/main.c index c24827c..7403ed4 100644 --- a/src/main.c +++ b/src/main.c @@ -55,12 +55,16 @@ int main(int argc, char **argv) case 'q': *running = false; return 0; case 'w': + if (player->direction == DOWN) break; player->direction = UP; break; case 'd': + if (player->direction == LEFT) break; player->direction = RIGHT; break; case 's': + if (player->direction == UP) break; player->direction = DOWN; break; case 'a': + if (player->direction == RIGHT) break; player->direction = LEFT; break; }