示例#1
0
 // creates the next piece on the board
 public void createInitialPiece()
 {
     tetromino  = new Tetromino(currentPiece);
     rotations  = tetromino.getRotations();
     pieceColor = tetromino.getColor();
     foreach (Point p in rotations[rotation])
     {
         boardArray[p.X + activePoint.X, p.Y + activePoint.Y].BackColor = pieceColor;
         if (fixedBlocks.Contains(boardArray[p.X + activePoint.X, p.Y + activePoint.Y]))
         {
             gameOver();
         }
     }
     showNextPiece();
 }
示例#2
0
        // Creates the next piece in the demoBoard
        public void showNextPiece()
        {
            Tetromino            nextTetromino = new Tetromino(nextPieces.Peek());
            List <List <Point> > nextRotations = nextTetromino.getRotations();
            Color nextPieceColor = nextTetromino.getColor();

            for (int i = 0; i < 4; i++)
            {
                for (int j = 0; j < 4; j++)
                {
                    demoBoard[j, i].BackColor   = Color.White;
                    demoBoard[j, i].BorderStyle = System.Windows.Forms.BorderStyle.FixedSingle;
                    //demoBoard[j, i].BorderStyle = System.Windows.Forms.BorderStyle.None;
                }
            }
            foreach (Point p in nextRotations[0])
            {
                demoBoard[p.X, p.Y].BackColor   = nextPieceColor;
                demoBoard[p.X, p.Y].BorderStyle = System.Windows.Forms.BorderStyle.FixedSingle;
            }
        }