console.log("loading input system"); const inputSystem = (engine) => { engine("registerEvent", "moveDown"); engine("registerEvent", "moveUp"); engine("registerEvent", "moveLeft"); engine("registerEvent", "moveRight"); document.addEventListener('keydown', (event) => { let target = event.target; switch (event.key) { case "ArrowDown": engine("queueEvent", "moveDown", {target}); break; case "ArrowUp": engine("queueEvent", "moveUp", {target}); break; case "ArrowLeft": engine("queueEvent", "moveLeft", {target}); break; case "ArrowRight": engine("queueEvent", "moveRight", {target}); break; } }); };