diff --git a/script.js b/script.js index ec53695..9587d33 100644 --- a/script.js +++ b/script.js @@ -326,6 +326,8 @@ async function startGame(gameID) { // Listen for key press events document.body.addEventListener("keydown", (ev) => { + if(!canvas.isConnected) + return; if(["ArrowDown", "ArrowLeft", "ArrowRight", "ArrowUp"].includes(ev.key)) key = ev.key;