我刚刚开始学习jQuery,并制作了Whack-a-mole游戏。游戏运行正常。但是一旦游戏结束,我再次单击开始游戏按钮,游戏就会开始,但“ Game Over”消息仍然存在。
这是我的仓库的链接:https://github.com/kshitiz20/Whack-a-mole
以下是游戏的链接:https://kshitiz20.github.io/Whack-a-mole/
如何解决此错误?
答案 0 :(得分:2)
这应该为您工作:
function startGame(){
makeGameBoard();
score=0;
$('.score').text(score);
startMoles();
gameOver=false;
$('.message').html(''); <-- clear the html
setTimeout(function(){
return gameend();
},15000);
}