javascript - "Game Over" not disappearing after clicking for second time on "Start game" in Whack-a-mole
问题描述
I just started learning jQuery and have made a Whack-a-mole game. The game is working just fine. But once the game gets over and I click the start game button again, the game starts but "Game Over" message is still there.
Here is the link to my repo: https://github.com/kshitiz20/Whack-a-mole
Here is the link to the game: https://kshitiz20.github.io/Whack-a-mole/
How do i fix this bug?
解决方案
这应该为你工作:
function startGame(){
makeGameBoard();
score=0;
$('.score').text(score);
startMoles();
gameOver=false;
$('.message').html(''); <-- clear the html
setTimeout(function(){
return gameend();
},15000);
}
推荐阅读
- scala - 无法展平 DataFrame 数组
- f# - 将列表列表与 F# 中的列表相乘
- python - 如何使用 VisPy 库实时绘图?
- node.js - Circleci,SequelizeConnectionError:主机没有 pg_hba.conf 条目
- oracle - 带有重新定义子句的大型机字帖以在 oracle 外部表中加载数据
- javascript - 如何在来自 node.js 的 javascript 响应中安全地嵌入查询参数?
- python - 依次从数组运行倒数计时器
- html - 是否可以使用 Rollup 创建一个从模板注入 HTML 的包?
- apache-spark - Spark - 读取 CSV 文件并执行串行模式
- python - Python 随机项目