function createShape() {
  currentShape = new CurrentShape(nextShapeName);
  var svg = document.getElementById('shape');
  svg.appendChild(currentShape.g);
  updateNextShape();
  printDebug();
  // Check for "block out" game over condition (shape overlaps with blocks).
  if (currentShape.isCollided()) {
    console.log('Game over: Block out.');
    fail();
    return;
  }
  if (!currentShape.isSurfaced()) {
    actionDown();
  }
  // Reset the timer so that the first turn of the new shape is whole.
  fallPid = setInterval(actionDown, speed);
  currentShape.checkSurfaced();
  mode = modes.PLAYING;

  // Reset autorepeat for the new shape.
  stopAutoRepeat();
  if (keyStatus.ArrowLeft) {
    initAutoRepeat('ArrowLeft');
  } else if (keyStatus.ArrowRight) {
    initAutoRepeat('ArrowRight');
  }
}
// Create new shape on the board.
Create new shape on the board.
Create new shape on the board .
function createShape() {
  currentShape = new CurrentShape(nextShapeName);
  var svg = document.getElementById('shape');
  svg.appendChild(currentShape.g);
  updateNextShape();
  printDebug();
  if (currentShape.isCollided()) {
    console.log('Game over: Block out.');
    fail();
    return;
  }
  if (!currentShape.isSurfaced()) {
    actionDown();
  }
  fallPid = setInterval(actionDown, speed);
  currentShape.checkSurfaced();
  mode = modes.PLAYING;
  stopAutoRepeat();
  if (keyStatus.ArrowLeft) {
    initAutoRepeat('ArrowLeft');
  } else if (keyStatus.ArrowRight) {
    initAutoRepeat('ArrowRight');
  }
}
function createShape ( ) { currentShape = new CurrentShape ( nextShapeName ) ; var svg = document . getElementById ( 'shape' ) ; svg . appendChild ( currentShape . g ) ; updateNextShape ( ) ; printDebug ( ) ; if ( currentShape . isCollided ( ) ) { console . log ( 'Game over: Block out.' ) ; fail ( ) ; return ; } if ( ! currentShape . isSurfaced ( ) ) { actionDown ( ) ; } fallPid = setInterval ( actionDown , speed ) ; currentShape . checkSurfaced ( ) ; mode = modes . PLAYING ; stopAutoRepeat ( ) ; if ( keyStatus . ArrowLeft ) { initAutoRepeat ( 'ArrowLeft' ) ; } else if ( keyStatus . ArrowRight ) { initAutoRepeat ( 'ArrowRight' ) ; } }
Create new shape on the board.
Create new shape on the board .
// Check for "block out" game over condition (shape overlaps with blocks). // Reset the timer so that the first turn of the new shape is whole. // Reset autorepeat for the new shape.