Add move to start of screen every tick
parent
a064af95da
commit
84e21cb515
|
@ -26,6 +26,11 @@ Food generateFood(Player *player)
|
||||||
return food;
|
return food;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void resetCoordinates(void)
|
||||||
|
{
|
||||||
|
printf("\033[0;0H");
|
||||||
|
}
|
||||||
|
|
||||||
int main(int argc, char **argv)
|
int main(int argc, char **argv)
|
||||||
{
|
{
|
||||||
srandom(time(NULL));
|
srandom(time(NULL));
|
||||||
|
@ -76,6 +81,7 @@ int main(int argc, char **argv)
|
||||||
screenSet(screen, ' ');
|
screenSet(screen, ' ');
|
||||||
drawPlayer(player, screen);
|
drawPlayer(player, screen);
|
||||||
*screenGetPoint(screen, food.x, food.y) = '@';
|
*screenGetPoint(screen, food.x, food.y) = '@';
|
||||||
|
resetCoordinates();
|
||||||
screenShow(screen);
|
screenShow(screen);
|
||||||
for (i = 0; i < 20; ++i) putchar('-');
|
for (i = 0; i < 20; ++i) putchar('-');
|
||||||
printf("\nScore: %d\n", player->score);
|
printf("\nScore: %d\n", player->score);
|
||||||
|
|
Loading…
Reference in New Issue