forked from nakidai/csnake
1
0
Fork 0

Some fixes

- Now every frame is cleared
- Fix collision with self
master
Nakidai 2023-10-30 15:35:15 +03:00
parent 84e21cb515
commit d6b4f0be32
Signed by untrusted user who does not match committer: nakidai
GPG Key ID: 914675D395210A97
2 changed files with 2 additions and 2 deletions

View File

@ -28,7 +28,7 @@ Food generateFood(Player *player)
void resetCoordinates(void) void resetCoordinates(void)
{ {
printf("\033[0;0H"); printf("\e[1;1H\e[2J");
} }
int main(int argc, char **argv) int main(int argc, char **argv)

View File

@ -36,7 +36,7 @@ bool playerCheckSelfCollision(Player *player)
PlayerNode *nodei, *nodej; PlayerNode *nodei, *nodej;
for (nodei = player->tail; nodei != NULL; nodei = nodei->next) for (nodei = player->tail; nodei != NULL; nodei = nodei->next)
for (nodej = nodei->next; nodej != NULL; nodej = nodej->next) for (nodej = nodei->next; nodej != NULL; nodej = nodej->next)
if (nodei->x == nodej->x && nodei->y == nodej->x) if (nodei->x == nodej->x && nodei->y == nodej->y)
return true; return true;
return false; return false;
} }