Пример #1
0
        private void MoveLinesDown()
        {
            if (LinesToClear.Any())
            {
                Thread.Sleep(100);

                int linesToMove = 0;

                for (int row = LinesToClear.Max(); row > 0; row--)
                {
                    if (LinesToClear.Contains(row))
                    {
                        linesToMove++;
                    }
                    else
                    {
                        for (int col = 0; col < TowerData.GetLength(1); col++)
                        {
                            if (TowerData[row, col] != BlockValue.Empty)
                            {
                                BlockValue tempVal = TowerData[row, col];
                                TowerData[row, col] = BlockValue.Empty;
                                TowerData[row + linesToMove, col] = tempVal;
                            }
                        }
                    }
                }

                LinesToClear.Clear();
                ClearState = ClearState.Check;
            }
        }
Пример #2
0
    public bool extra()
    {
        if (LinesToClear.Count != 0)
        {
            masAlto = LinesToClear[LinesToClear.Count - 1];
            masBajo = LinesToClear[0];
            for (int i = 0; i < LinesToClear.Count; i++)
            {
                int xd = LinesToClear[i];
                for (int j = 1; j < fieldWidth - 1; j++)
                {
                    field[j, xd] = ' ';
                }
                LineasLimpiadas++;
                if (LineasLimpiadas % 10 == 0)
                {
                    if (speed >= 5)
                    {
                        speed--;
                    }
                }
            }

            Score += ((1 << LinesToClear.Count) * 10);
            LinesToClear.Clear();
            noInput = true;
            return(false);
        }
        if (noInput)
        {
            noInput = false;
            int margen = masAlto - masBajo + 1; //margen entre las lineas borradas y las q tienen q bajar
            for (int i = masAlto; i >= 0 + margen; i--)
            {
                for (int j = 1; j < fieldWidth - 1; j++)
                {
                    field[j, i] = field[j, i - margen];
                }
            }
            //cuando termina de eliminar las lineas reseteamos esto para la proxima
            masAlto = 0;
            masBajo = 0;
            return(false);
        }

        return(true);
    }