Fix input not working well on GameJolt's page
This commit is contained in:
parent
30ce6e65a4
commit
cd2a866dfe
3 changed files with 5 additions and 4 deletions
|
@ -20,6 +20,7 @@ canvas {
|
|||
margin: -140px -250px;
|
||||
transform: scale(1.7, 1.7);
|
||||
box-shadow: 3px 3px 5px black;
|
||||
pointer-events: none;
|
||||
}
|
||||
div {
|
||||
width: 300px;
|
||||
|
|
|
@ -4,11 +4,11 @@ Game = (function() {
|
|||
var currentScene, incomingScene;
|
||||
|
||||
Game.init = function(callback) {
|
||||
Renderer.init(initScene);
|
||||
|
||||
Music.init();
|
||||
SFX.init();
|
||||
|
||||
Renderer.init(initScene);
|
||||
|
||||
function initScene() {
|
||||
// Run callback to set the inital scene.
|
||||
callback();
|
||||
|
|
|
@ -55,14 +55,14 @@ Input = (function() {
|
|||
}
|
||||
}
|
||||
|
||||
window.addEventListener("keydown", function(event) {
|
||||
window.document.addEventListener("keydown", function(event) {
|
||||
if (usedKeys[event.keyCode]) {
|
||||
event.preventDefault();
|
||||
keys[event.keyCode] = true;
|
||||
}
|
||||
});
|
||||
|
||||
window.addEventListener("keyup", function(event) {
|
||||
window.document.addEventListener("keyup", function(event) {
|
||||
if (usedKeys[event.keyCode]) {
|
||||
event.preventDefault();
|
||||
keys[event.keyCode] = false;
|
||||
|
|
Loading…
Add table
Reference in a new issue