title: character stops after second key pressed is lifted
body: <p>I'm taking input from the arrow keys and moving a character accordingly on a 2D canvas game in JavaScript.</p>
  
  <p>When I press two keys, I want special things to happen like moving diagonally and stopping.</p>
  
  <p>These special things do happen, however there is a glitch when I lift up the second key that was pressed down: my character stops moving.  This doesn't happen, though, if I lift the first key pressed and keep the second key pressed.  In that case, my character continues in that direction.  Why does this occur??</p>
  
  <p><strong>Here is a snippet of the function:</strong></p>
  
  <pre><code>//both up and down keys pressed, character should stop
  if(Keys.up &amp;&amp; Keys.down){
      character.y -= 10;
      character.y += 10;
  }
  else if(Keys.down){
      character.y += 10;
  }
  else if(Keys.up){
      character.y -= 10;
  }
  </code></pre>
  
  <p>Also, I am taking the input from <code>onkeydown</code> and <code>onkeyup</code> events and storing them in an object called Keys.  (e.g. <code>Keys[e.keyCode] = true )</code>
  When the key is pressed, that key's boolean value is true.  When lifted it is false.</p>