Пример #1
0
    //падение фигуры
    void MoveDown()
    {
        int[,] tmp = new int[heightTable, widthTable];
        for (int y = heightTable - 1; y >= 0; y--)
        {
            for (int x = 0; x < widthTable; x++)
            {
                if (y > 0)
                {
                    if (table [y, x] == 2 && (table [y - 1, x] == 1 || table[y - 1, x] == 3))
                    {
                        Replace();
                        return;
                    }
                }

                if ((table [y, x] == 1 || table[y, x] == 3) && y == 19)
                {
                    Replace();
                    return;
                }
                if (y < heightTable - 1)
                {
                    if (table [y, x] == 1 || table[y, x] == 3)
                    {
                        tmp [y + 1, x] = table[y, x];
                    }
                }
                if (table [y, x] == 2)
                {
                    tmp [y, x] = 2;
                }
            }
        }
        table = tmp;
        figure.AddYCoord();
    }