Oops! Quick page fix.


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 Play in browser
50 days ago

Get Lily Lander C64

Download NowName your own price

Leave a comment

Log in with itch.io to leave a comment.