|
|
@ -77,12 +77,13 @@ void game_snake(){ |
|
|
|
while (running){ |
|
|
|
system("clear"); |
|
|
|
draw_snake(&snake, fruit); |
|
|
|
if(check_if_dead(&snake)){break;} |
|
|
|
if(check_if_dead(&snake)){printf("You Lose!"); getchar(); break;} |
|
|
|
t = clock() - t; |
|
|
|
get_next_move(TIME_TURN - (double)t / CLOCKS_PER_SEC, &snake, &running); |
|
|
|
t = clock(); |
|
|
|
move_snake(&snake); |
|
|
|
if(part_of_snake(&snake, fruit) == 0){fruit = eating_fruit(&snake);} |
|
|
|
if(snake.length == WIDTH * HEIGHT){printf("You Win!"); running = false; getchar();} |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|