Now player can't turn into itself

pull/2/head
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': case 'q':
*running = false; return 0; *running = false; return 0;
case 'w': case 'w':
if (player->direction == DOWN) break;
player->direction = UP; break; player->direction = UP; break;
case 'd': case 'd':
if (player->direction == LEFT) break;
player->direction = RIGHT; break; player->direction = RIGHT; break;
case 's': case 's':
if (player->direction == UP) break;
player->direction = DOWN; break; player->direction = DOWN; break;
case 'a': case 'a':
if (player->direction == RIGHT) break;
player->direction = LEFT; break; player->direction = LEFT; break;
} }