Skip to content
Snippets Groups Projects
Commit ebef1a31 authored by Lalit2.Dangi@live.uwe.ac.uk's avatar Lalit2.Dangi@live.uwe.ac.uk
Browse files

Edit game.c

parent 01431ce5
No related branches found
No related tags found
No related merge requests found
......@@ -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;
......@@ -26,8 +27,9 @@ void UpdateBall(Ball *ball, Paddle *paddle) {
if (CheckCollisionCircleRec(ball->position, ball->radius, paddle->rect)) {
ball->speed.x *= -1;
ball->score++; // ✅ Increase score when ball hits paddle
}
}
void DrawGame(Paddle *paddle, Ball *ball) {
DrawRectangleRec(paddle->rect, BLUE);
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment