Exemplo n.º 1
0
/*
 * Setzt das Feld, alle Felder sind zu Anfang leer
 * bzw. sind nicht mit einer Blockfarbe belegt.
 */
void initField(int difficulty) {

  // Setze Standard für Schwierigkeitsgrad
  if (!(difficulty >= 0 && difficulty < 3)) {
    difficulty = 1;
  }

  /*
   * Je nach Schwierigkeit differnziert die Feldgröße
   * easy 16 / 12
   * middle 14 / 10
   * hard 12 / 8
   */
  switch (difficulty) {
  case 2: // hard
    FIELD_COLS  = 8;
    FIELD_ROWS = 12;
    break;
  case 1: // normal
    FIELD_COLS  = 10;
    FIELD_ROWS = 14;
    break;
  case 0: // easy
  default:
    FIELD_COLS  = 12;
    FIELD_ROWS = 16;
    break;
  }

  hasBlockContainer = false;
  hasFallingBlocks  = false;

  initBlockColors();

  // Belegt alle Felder mit dem Blockfarben Index für Transparenz
  for (int x=0; x < FIELD_COLS; x++) {
    for (int y=0; y < FIELD_ROWS; y++) {
      fieldBlocks[x][y] = 0;
    }
  }

  // Blockcontainer initialisieren, diesen Container kann der Spieler steuern
  for (int i=0; i < BLOCK_CONTAINER_SIZE; i++) {
    blockContainer[i][0] = -1; // x
    blockContainer[i][1] = -1; // y
    blockContainer[i][2] = -1; // Hilfsvariable zum verschieben von Blockgruppen
  }
}
Exemplo n.º 2
0
void CColorManager::initAll()
{
	initCommonColor();
	initBlockColors();
}