Javascript游戏控制清除timeOut

时间:2016-01-11 08:27:21

标签: javascript onmouseover cleartimeout

我想在我的在线键盘程序中构建一个小游戏,并想知道是否有些更有经验的javascript开发人员可以帮助我在我的onmouseover控制。我似乎无法使onmouseout停止onmouseover函数重复。

var GameControleUPLEFT;

var GameControleTime =  25;

document.getElementById('SpillKontrollOppVenstre').onmouseout=function cleartimeout(GameControleUPLEFT){};

document.getElementById('SpillKontrollOppVenstre').onmouseover=function(){LHPlAYCONTROLEUPLEFT();};
function LHPlAYCONTROLEUPLEFT(){ // Player holding up-left
elf.y -= elf.speed * modifier;
elf.x -= elf.speed * modifier;
document.getElementById("GameInfo").innerHTML = "up - left";
for (i=0;i<blocks.length ;i++ )
if (isTouching(elf,blocks[i]))
{
            elf.y = blocks[i].y + blocks[i].h +1
        }
}
GameControleUPLEFT=setTimeout(LHPlAYCONTROLEUPLEFT,GameControleTime);
GameControleUPLEFT;
}

0 个答案:

没有答案