forked from nakidai/csnake
1
0
Fork 0

Optimize game over condition

Nakidai 2023-11-01 13:27:42 +03:00
parent 460e4e33ed
commit bcf6465f4e
Signed by untrusted user who does not match committer: nakidai
GPG Key ID: 914675D395210A97
1 changed files with 1 additions and 6 deletions

View File

@ -70,14 +70,9 @@ int main(int argc, char **argv)
if (playerDoTick(player, food))
food = generateFood(player);
if (playerCheckSelfCollision(player))
{
*running = false;
break;
}
head_x = player->head->x;
head_y = player->head->y;
if (head_x >= SIZE || head_x < 0 || head_y >= SIZE || head_y < 0)
if (head_x >= SIZE || head_x < 0 || head_y >= SIZE || head_y < 0 || playerCheckSelfCollision(player))
{
*running = false;
break;