forked from nakidai/csnake
1
0
Fork 0

Now player can't turn into itself

master
Nakidai 2023-10-31 05:05:10 +03:00
parent 21e1f14990
commit 8b9fcdd3df
Signed by untrusted user who does not match committer: nakidai
GPG Key ID: 914675D395210A97
1 changed files with 4 additions and 0 deletions

View File

@ -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;
}