diff --git a/src/game.h b/src/game.h index a71f5aecbaafdf724e754402f355115a76853bf8..239812c97eb112f5879edf47d4e99e8321a2280d 100644 --- a/src/game.h +++ b/src/game.h @@ -13,6 +13,6 @@ void HandleInput(Snake *snake); void ResetGame(Snake *snake, Food *food, int *score, bool *gameOver); // New version that supports obstacles (doesn't replace the old one) -void ResetGameWithObstacles(Snake *snake, Food *food, Obstacle obstacles[], int *score, GameState *state); +void ResetGameWithObstacles(Snake *snake, Food *food, Obstacle obstacles[], int *score, int *level, GameState *state); #endif \ No newline at end of file diff --git a/src/main.c b/src/main.c index 77eb12a64ff6a29ec5385fc3fcb4b4c19e1eb7d5..41dd8a48fc1b2961ec70e9678c0b49c59af7506d 100644 --- a/src/main.c +++ b/src/main.c @@ -21,11 +21,12 @@ void HandleFlashEffect(int *flashFrames, Color *flashColor) { } // Change the function name to match game.h -void ResetGameWithObstacles(Snake *snake, Food *food, Obstacle obstacles[], int *score, GameState *state) { +void ResetGameWithObstacles(Snake *snake, Food *food, Obstacle obstacles[], int *score, int *level, GameState *state) { InitSnake(snake); SpawnFood(food); InitObstacles(obstacles, MAX_OBSTACLES); *score = 0; + *level = 1; *state = PLAYING; // Spawn initial obstacles @@ -67,7 +68,7 @@ int main(void) { case MENU: if (IsKeyPressed(KEY_ENTER)) { // Changed to ResetGameWithObstacles - ResetGameWithObstacles(&snake, &food, obstacles, &score, &gameState); + ResetGameWithObstacles(&snake, &food, obstacles, &score, &gameState, &level); flashColor = PURPLE; flashFrames = 1; } @@ -103,7 +104,7 @@ int main(void) { case GAME_OVER: if (IsKeyPressed(KEY_ENTER)) { // Changed to ResetGameWithObstacles - ResetGameWithObstacles(&snake, &food, obstacles, &score, &gameState); + ResetGameWithObstacles(&snake, &food, obstacles, &score, &gameState, &level); flashColor = GREEN; flashFrames = 5; }