6 ms·
This seems to have the same property I've seen in quite a few other HTML5 games: the arrow keys get used for movement but also still get interpreted by the brow
by JoshTriplett 15y ago
This seems to have the same property I've seen in quite a few other HTML5 games: the arrow keys get used for movement but also still get interpreted by the browser to scroll the page. Both seem important: I usually don't want anything to break the arrow keys for scrolling, but on the other hand for something like this I don't really want the page to move around as I play. (Of course, for something like this perhaps the page just needs to become small enough to not need scrolling, which would fix the problem, but the general issue still applies.)
- woodall 15y agoOr catch the key's event trigger with onfocus or onkeydown. That way even if they are pressed, nothing will happen.
- Tyrant505 15y agoThis brings up a good point. The controls are even set swapped compared to gamepads, so using the wrong hand isn't comfortable. Old computer games did use the pc arrows of course. But now since this is a remake of the classic, it should at least be hand aware :)
- sid0 15y agoFlipping around the hands used for directions and actions is standard with emulator keyboard input, actually.
- Groxx 15y agoNow that I think about it, it's really weird. I play FPSes at times, and WASD feels natural, but WASD+JKL for, say, Sega emulation feels wrong compared to ↑←↓→+ASD(/ZXC, for you crazy Japanese-targeted-game fans).
- Groxx 15y agoNo, they're just all making the same crazy omission: event.preventDefault(); I have a fix, if you're interested, in my top-level comment: http://news.ycombinator.com/item?id=2798835 http://news.ycombinator.com/item?id=2798835
- middus 15y agoThis will deactivate all keys, including e.g. F5 for refresh. Moreover, mentioning this here won't necesserily get it fixed. Here's a pull request: https://github.com/robertkleffner/mariohtml5/pull/3 https://github.com/robertkleffner/mariohtml5/pull/3 Feel free to comment / add.
- Groxx 15y agoWhich is why you restrict it by A) the list of known keys (the values are already in an array in the same file), and if you're feeling nice B) after clicking inside the container the game lives in. All of which is mind-numbingly easy, but far below 50% of "HTML5" games I've played have done so.