itch.io is community of indie game creators and players

Devlogs

Oops! Quick page fix.

Lily Lander C64
A browser C64 game made in HTML5

You’d think after all the other games I’ve been testing where I have problems with keyboard entry in the browser that I wouldn’t make the same mistake. Pressing the spacebar in the emulator was causing the page to scroll on my gamepage, so I added a quick fix. I’ll share it here if any other devs encounter the same thing when embedding their game:

I added this in a script block in the page to disable the scrollbar if the emulator is not selected:

window.onkeydown = function(e) {
    if (e.keyCode == 32 && e.target == document.body) {
        e.preventDefault();
    }
};

Drop in the keycodes you need for your game, or the ones you’re having problems with. It should really only be a problem with the arrow keys and the spacebar, though (I think).

Files

  • Lily Lander Web 1 MB
    Dec 06, 2019
Download Lily Lander C64
Leave a comment