Esempio n. 1
0
 public void initializeGame()
 {
     window.setScore(0);
     root                 = new int[2];
     root[0]              = 3;
     root[1]              = 0;
     converter            = new BrushConverter();
     imageConverter       = new ImageSourceConverter();
     board                = new Board(window);
     bf                   = new BlockFactory();
     nextBlock            = bf.newBlock();
     storageBlock         = null;
     currentBlockPosition = new int[10, 18];
     currentBlock         = bf.newBlock();
     setNewBlock(currentBlock.getBlock());
     window.nextImage.Source = (ImageSource)imageConverter.ConvertFromString("pack://application:,,,/images/" + nextBlock.getImage());
 }
Esempio n. 2
0
        public void checkForLines()
        {
            int     count        = 0;
            int     clearedLines = 0;
            Boolean clearedLine  = false;

            for (int y = 17; y >= 0; y--)
            {
                count = 0;
                for (int x = 0; x < 10; x++)
                {
                    if (boardGrid[x, y] == 0)
                    {
                        break;
                    }
                    count++;
                    if (count == 10)
                    {
                        clearedLine = true;
                        clearedLines++;
                        totalClearedLines++;
                        tempoCheck();
                        clearLine(y);
                        getBoardColors(y);
                        shiftBoardDown(y);
                        y++;
                    }
                }
            }

            if (clearedLine == true)
            {
                currentScore += ((100 * clearedLines) * window.getLevel());
                if (clearedLines > 1)
                {
                    currentScore += ((50 * (clearedLines - 1)) * window.getLevel());
                }
                window.setScore(currentScore);
            }
        }