|
|
@ -1,21 +1,11 @@ |
|
|
|
#include <stdio.h> |
|
|
|
#include <stdbool.h> |
|
|
|
|
|
|
|
|
|
|
|
#define HEIGHT 15 |
|
|
|
#define WIDTH 15 |
|
|
|
#define AREA HEIGHT * WIDTH |
|
|
|
|
|
|
|
typedef struct{ |
|
|
|
signed char direction[2]; |
|
|
|
char length; |
|
|
|
unsigned char segments[AREA]; |
|
|
|
}Snake; |
|
|
|
#include "snake_start.h" |
|
|
|
|
|
|
|
|
|
|
|
void main_menu(); |
|
|
|
void game(); |
|
|
|
Snake initialize_game(); |
|
|
|
Snake initialize_snake(); |
|
|
|
void draw(Snake *snake); |
|
|
|
int part_of_snake(Snake *snake, unsigned char tile); |
|
|
|
|
|
|
@ -55,7 +45,7 @@ void main_menu(){ |
|
|
|
} |
|
|
|
|
|
|
|
void game(){ |
|
|
|
Snake snake = initialize_game(); |
|
|
|
Snake snake = initialize_snake(); |
|
|
|
bool running = true; |
|
|
|
while (running) |
|
|
|
{ |
|
|
@ -66,7 +56,7 @@ void game(){ |
|
|
|
getchar(); |
|
|
|
} |
|
|
|
|
|
|
|
Snake initialize_game(){ |
|
|
|
Snake initialize_snake(){ |
|
|
|
Snake snake = {{0, 1}, 3}; |
|
|
|
for(int i = 0; i < AREA; i++){ |
|
|
|
snake.segments[i] = 0; |
|
|
|