Ejemplo n.º 1
0
        private void MoveBlockDown()
        {
            curBlock.MoveDown(dy);
            if (grid.IsCollision())
            {
                if (curBlock.y <= 2)
                {
                    curBlock.MoveUp(dy);
                    this.Invalidate();
                    isGameOver = true;
                    return;
                }
                curBlock.MoveUp(dy);
                grid.AddBlockToGrid();
                int lines = grid.ClearLines();
                totLines += lines;
                score    += lines * modifier;

                // give a 2x modifier for 3 cleared lines; another 2x for 4 cleared lines
                if (lines >= 3)
                {
                    lblBonus.Visible = true;
                    modifier        *= 2;
                }
                if (lines == 4)
                {
                    modifier *= 2;
                }

                curBlock  = grid.CreateNewBlock(nextBlock.type, gridWidth / 2 - 1, 0);
                nextBlock = new TetrisBlock(RandomBlock(), 12, 12, scaleX, scaleY);
            }
        }