From ebef1a311864f844c45de9b31a689257551f429c Mon Sep 17 00:00:00 2001
From: "Lalit2.Dangi@live.uwe.ac.uk" <lalit2.dangi@live.uwe.ac.uk>
Date: Fri, 4 Apr 2025 10:18:01 +0000
Subject: [PATCH] Edit game.c

---
 game.c | 6 ++++--
 1 file changed, 4 insertions(+), 2 deletions(-)

diff --git a/game.c b/game.c
index b2de0e4..c6cc6e1 100644
--- a/game.c
+++ b/game.c
@@ -15,6 +15,7 @@ Ball *CreateBall(float x, float y, int radius, float speedX, float speedY) {
     b->radius = radius;
     return b;
 }
+b->score = 0;  // ✅ Start score at 0
 
 void UpdateBall(Ball *ball, Paddle *paddle) {
     ball->position.x += ball->speed.x;
@@ -25,10 +26,11 @@ void UpdateBall(Ball *ball, Paddle *paddle) {
     }
 
     if (CheckCollisionCircleRec(ball->position, ball->radius, paddle->rect)) {
-        ball->speed.x *= -1;
-    }
+    ball->speed.x *= -1;
+    ball->score++;  // ✅ Increase score when ball hits paddle
 }
 
+
 void DrawGame(Paddle *paddle, Ball *ball) {
     DrawRectangleRec(paddle->rect, BLUE);
     DrawCircleV(ball->position, ball->radius, RED);
-- 
GitLab