From 5028e654e9ee8d2b8b84ac99881c05f4efeb8e42 Mon Sep 17 00:00:00 2001
From: "Ahmet Sungur (Student)"
 <ahmet2.sungur@live.uwe.ac.uk@csctcloud.prxhn32zsyjupl12zde3wlfkch.cwx.internal.cloudapp.net>
Date: Wed, 2 Apr 2025 14:59:23 +0100
Subject: [PATCH] finally

---
 src/game.h | 2 +-
 src/main.c | 7 ++++---
 2 files changed, 5 insertions(+), 4 deletions(-)

diff --git a/src/game.h b/src/game.h
index a71f5ae..239812c 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 77eb12a..41dd8a4 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;
                 }
-- 
GitLab