Skip to content

Commit a2a155b

Browse files
committed
Score check (for gameover) are now done only when someone scores
1 parent 66909f7 commit a2a155b

File tree

1 file changed

+2
-1
lines changed

1 file changed

+2
-1
lines changed

Scripts/game.js

+2-1
Original file line numberDiff line numberDiff line change
@@ -345,7 +345,6 @@ function draw()
345345
cameraPhysics();
346346
playerPaddleMovement();
347347
opponentPaddleMovement();
348-
matchScoreCheck();
349348
}
350349

351350
function ballPhysics()
@@ -359,6 +358,7 @@ function ballPhysics()
359358
document.getElementById("scores").innerHTML = score1 + "-" + score2;
360359
// reset ball to center
361360
resetBall(2);
361+
matchScoreCheck();
362362
}
363363

364364
// if ball goes off the 'right' side (CPU's side)
@@ -370,6 +370,7 @@ function ballPhysics()
370370
document.getElementById("scores").innerHTML = score1 + "-" + score2;
371371
// reset ball to center
372372
resetBall(1);
373+
matchScoreCheck();
373374
}
374375

375376
// if ball goes off the top side (side of table)

0 commit comments

Comments
 (0)