From d6b4f0be328fd5b10ef5c5d910d21cc51f6def50 Mon Sep 17 00:00:00 2001 From: Nakidai Date: Mon, 30 Oct 2023 15:35:15 +0300 Subject: [PATCH] Some fixes - Now every frame is cleared - Fix collision with self --- src/main.c | 2 +- src/player.c | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/src/main.c b/src/main.c index cb52e00..570ad51 100644 --- a/src/main.c +++ b/src/main.c @@ -28,7 +28,7 @@ Food generateFood(Player *player) void resetCoordinates(void) { - printf("\033[0;0H"); + printf("\e[1;1H\e[2J"); } int main(int argc, char **argv) diff --git a/src/player.c b/src/player.c index 9170645..3cab937 100644 --- a/src/player.c +++ b/src/player.c @@ -36,7 +36,7 @@ bool playerCheckSelfCollision(Player *player) PlayerNode *nodei, *nodej; for (nodei = player->tail; nodei != NULL; nodei = nodei->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 false; }