function keyDown(e) {
  if (isStartVisible || !isRunning || e.repeat) {
    return;
  }
  switch (e.key) {
    case 'ArrowLeft':
      move(-1, 0);
      break;
    case 'ArrowRight':
      move(1, 0);
      break;
    case 'ArrowUp':
      move(0, -1);
      break;
    case 'ArrowDown':
      move(0, 1);
      break;
    default:
      return;
  }
  e.preventDefault();
}
// Player is changing directions using the keyboard.
Player is changing directions using the keyboard.
Player is changing directions using the keyboard .
function keyDown(e) {
  if (isStartVisible || !isRunning || e.repeat) {
    return;
  }
  switch (e.key) {
    case 'ArrowLeft':
      move(-1, 0);
      break;
    case 'ArrowRight':
      move(1, 0);
      break;
    case 'ArrowUp':
      move(0, -1);
      break;
    case 'ArrowDown':
      move(0, 1);
      break;
    default:
      return;
  }
  e.preventDefault();
}
function keyDown ( e ) { if ( isStartVisible || ! isRunning || e . repeat ) { return ; } switch ( e . key ) { case 'ArrowLeft' : move ( - 1 , 0 ) ; break ; case 'ArrowRight' : move ( 1 , 0 ) ; break ; case 'ArrowUp' : move ( 0 , - 1 ) ; break ; case 'ArrowDown' : move ( 0 , 1 ) ; break ; default : return ; } e . preventDefault ( ) ; }
Player is changing directions using the keyboard.
Player is changing directions using the keyboard .