|
|
@ -19,7 +19,7 @@ void options_snake(); |
|
|
|
Snake initialize_snake(); |
|
|
|
void get_next_move(double limit, Snake *snake, bool *running); |
|
|
|
void move_snake(Snake *snake); |
|
|
|
void draw(Snake *snake, unsigned char fruit); |
|
|
|
void draw_snake(Snake *snake, unsigned char fruit); |
|
|
|
int part_of_snake(Snake *snake, unsigned char tile); |
|
|
|
bool check_if_dead(Snake *snake); |
|
|
|
unsigned char spawn_fruit(Snake *snake); |
|
|
@ -76,7 +76,7 @@ void game_snake(){ |
|
|
|
|
|
|
|
while (running){ |
|
|
|
system("clear"); |
|
|
|
draw(&snake, fruit); |
|
|
|
draw_snake(&snake, fruit); |
|
|
|
if(check_if_dead(&snake)){break;} |
|
|
|
t = clock() - t; |
|
|
|
get_next_move(TIME_TURN - (double)t / CLOCKS_PER_SEC, &snake, &running); |
|
|
@ -141,7 +141,7 @@ void move_snake(Snake *snake){ |
|
|
|
snake->segments[0] += snake->direction; |
|
|
|
} |
|
|
|
|
|
|
|
void draw(Snake *snake, unsigned char fruit){ |
|
|
|
void draw_snake(Snake *snake, unsigned char fruit){ |
|
|
|
printf("Score:%d Speed:%f\n", snake->length - START_LENGTH, TIME_TURN); |
|
|
|
printf("+"); |
|
|
|
for(int i = 0; i < WIDTH; i++){printf("-");} |
|
|
|