title: Game: Keyboard Input Simultaneously (Run & Jump)
body: <p>I'm trying to create a jquery powered platformer, but I'm a novice at most. The first issue I've run into is simultaneous keyboard input (run and jump so to speak). Just wondering what I'm doing wrong;</p>
  
  <pre><code>var tickRate = 100,
      slideB = 0,
      slideC = 0,
      oldV = 0,
      time = 0;
  
  $('body').keydown(function(e){
      e.stopPropagation();
      if (e.keyCode == '38') { jump(); }
      if (e.keyCode == '40') { }
      if (e.keyCode == '37') { slideB += 1; run(); }
      if (e.keyCode == '39') { slideB -= 1; run(); }
      $("#Background").css('left', (slideB * 10) + 'px');
      $("#Tell").html(slideB);
  });
  
  var run = function() {
      slideC -= 1;
      if (slideC &lt; -20) {slideC = 0;}
      $("#Sprite").html(slideC * -11);
  };
  
  var jump = function(){
      $("#Character").animate({ top: "50px" },{ duration: 1000, easing: "easeOutQuad" });
      $("#Character").animate({ top: "200px" },{ duration: 1000, easing: "easeInQuad" });
  }
  </code></pre>
  
  <p>Currently, if I have Run pressed down (right arrow), then I jump (up arrow), I stop running, until I press Run again.</p>
  
  <p>I am going to need an up-counter at some point, so maybe I could tie in a 'check if key is pressed' script.</p>
  
  <p>Any suggestions are helpful. Thanks.</p>