Note that there are some explanatory texts on larger screens.

plurals
  1. PO
    primarykey
    data
    text
    <p>Well this looks like a fun project so it got me curious and I started to look around. I found an article on Quirksmode that talks about using keycode vs character code. I see that you are detecting both upper and lower case letters. The following blurb seems to indicate that this is unnecessary. This article also has important docs on browser compatibility and special key compatibility between browsers and systems. For instance, the command button on a Mac keyboard. What is it? How is it detected and behaves in various browsers?</p> <blockquote> <p>for instance, a lower case 'a' and an upper case 'A' have the same keyCode, because the user presses the same key, but a different charCode because the resulting character is different.</p> </blockquote> <p><a href="http://www.quirksmode.org/js/keys.html" rel="nofollow noreferrer">http://www.quirksmode.org/js/keys.html</a></p> <p>So then the question becomes, how do you detect multiple key presses. I found this SO answer on it that is remarkably simple and straightforward. </p> <p><a href="https://stackoverflow.com/questions/4954403/can-jquery-keypress-detect-more-than-one-key-at-the-same-time">Can jQuery .keypress() detect more than one key at the same time?</a></p> <pre><code>var keys = {}; $(document).keydown(function (e) { keys[e.which] = true; }); $(document).keyup(function (e) { delete keys[e.which]; }) </code></pre> <p><strong>Update</strong></p> <p>Basically I just brought in the code from above, deleted your diagonal code and iterated over the keys array for all movement operations.</p> <p><a href="http://jsfiddle.net/mrtsherman/8NW2K/3/" rel="nofollow noreferrer">http://jsfiddle.net/mrtsherman/8NW2K/3/</a></p>
    singulars
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. VO
      singulars
      1. This table or related slice is empty.
    2. VO
      singulars
      1. This table or related slice is empty.
    3. VO
      singulars
      1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload