我按照教程制作了剪刀石头布游戏,现在我想更进一步,在玩家或计算机得分达到 10 分时添加消息/结束游戏。我无法确定出我需要做的事情。
let user = ["Player", "Computer"];
let pScore = 0;
let cScore = 0;
let gameIsOver = false;
// Some other functions in here...
// End Game
if (pScore === 10) {
isGameOver = true;
winner.textContent = `${user[0]} Wins the Game!`;
return;
} else if (cScore === 10) {
isGameOver = true;
winner.textContent = `${user[1]} Wins the Game!`;
return;
} else {
isGameOver = false;
}
// Some other functions here...
噜噜哒
相关分类