Browse Source

Snake adding Win and Lose Screen

remotes/origin/David
David Moeller 11 months ago
parent
commit
84f74de298
  1. 3
      src/main/c/Snake/snake_start.c

3
src/main/c/Snake/snake_start.c

@ -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();}
}
}

Loading…
Cancel
Save