xxxxxxxxxx
26
function checkOver() {
if (puck.leftscore == 10 || puck.rightscore == 10) {
let buffer = 40;
background(255, 0, 0);
fill(255);
textAlign(CENTER, CENTER);
strokeWeight(4);
textSize(64);
text("GAME OVER", width / 2, height / 2 - 100);
textSize(32);
text("Player 1 Score : " + puck.leftscore, width / 2, height / 2 - 50 + buffer);
text("Player 2 Score : " + puck.rightscore, width / 2, height / 2 + buffer);
if (puck.leftscore > puck.rightscore) {
text("Player 1 Wins !!", width / 2, height / 2 + 50 + buffer);
} else {
text("Player 2 Wins !!", width / 2, height / 2 + 50 + buffer);
}
noLoop();
}
}