谷歌 Chrome正在扔下“无尽的类型:没有确定财产是未经界定的”,但它不像我的法典那样看待任何东西。
我的不同组合的重要部分:
KEY = {
UP: 38,
DOWN: 40,
W: 87,
S: 83,
D: 68
}
pingpong = {
fps: 60,
pressedKeys: [],
complete: false,
}
Key listener initialization (this is where the error is thrown):
for (var keyCode in KEY) {
if (KEY.hasOwnProperty(keyCode)) {
pingpong.pressedKeys[KEY[keyCode]] = {
isDown: false,
wasDown: false
};
}
}
$(document).keydown(function(e) {
pingpong.pressedKeys[e.which].isDown = true;
});
$(document).keyup(function(e) {
/* This line is the issue */ pingpong.pressedKeys[e.which].isDown = false;
});
任何想法?