Updated: fixed some stuff
This commit is contained in:
parent
222b838e53
commit
fffcbbf123
2 changed files with 2 additions and 2 deletions
|
@ -253,7 +253,6 @@ void updateSnake() {
|
||||||
snake->tail->next = NULL;
|
snake->tail->next = NULL;
|
||||||
snake->head->prev->prev = NULL;
|
snake->head->prev->prev = NULL;
|
||||||
snake->head = snake->head->prev;
|
snake->head = snake->head->prev;
|
||||||
|
|
||||||
} else {
|
} else {
|
||||||
/* If the head overlaps with an apple (the snake ate an apple), move the apple to a new position */
|
/* If the head overlaps with an apple (the snake ate an apple), move the apple to a new position */
|
||||||
updateApple();
|
updateApple();
|
||||||
|
@ -479,6 +478,7 @@ int initializeGame() {
|
||||||
/* Initialize the apple */
|
/* Initialize the apple */
|
||||||
apple = startApple();
|
apple = startApple();
|
||||||
|
|
||||||
|
/* Run the game */
|
||||||
run();
|
run();
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
|
@ -44,7 +44,7 @@ typedef struct Snake {
|
||||||
|
|
||||||
/* Apple structure */
|
/* Apple structure */
|
||||||
typedef struct Food {
|
typedef struct Food {
|
||||||
int pX, pY; /* represents the apple's position on the board */
|
int pX, pY; /* represents the apple's position on the board */
|
||||||
} Apple;
|
} Apple;
|
||||||
|
|
||||||
#endif //SERPENT_H
|
#endif //SERPENT_H
|
||||||
|
|
Loading…
Reference in a new issue