【发布时间】:2019-11-08 03:31:49
【问题描述】:
我想在我的爆炸函数和重置函数之间有一个设定的时间,如果我没有设定的时间,代码在执行函数之后快速执行重置函数。这使得爆炸基本上是看不见的。我尝试在重置功能上设置超时,但这并没有改变任何东西。
代码如下:
function loop(){
//game code up here
if(out){
//run explode for certain amount of time then call reset function
explode();
//setTimeout(reset, time)
reset();
}
}
setInterval(loop, 10)
【问题讨论】:
标签: javascript timing