Пример #1
0
 public void reposition_of_blocks()
 {
     for (int i = 0; i < arrField.Length; i++)
     {
         arrField[i] = new Tiles_shapes(Color.Transparent, false);
     }
 }
Пример #2
0
        public void blocksMovements(Point point, ScreenDimensions wr)
        {
            int index_of_tile;
            int index_of_pic_field;

            for (int i = 0; i < wr.height; i++)
            {
                for (int j = 0; j < wr.width; j++)
                {
                    index_of_tile      = (wr.bottom + j) + (wr.top + i) * Block.Size;
                    index_of_pic_field = (point.x - game.bottom + j) + (point.y - game.top + i) * game.width;
                    if (tiles_array[index_of_tile])
                    {
                        arrField[index_of_pic_field] = new Tiles_shapes(Block.color(Block.Shape), true);
                    }
                }
            }

            rowsCompletion();
        }
Пример #3
0
        public void rowsCompletion()
        {
            int  height     = game.height;
            int  width      = game.width;
            int  count      = 0;
            bool isComplete = true;
            int  total_rows = height - 1;

            Tiles_shapes[] array_for_blocks_creation = new Tiles_shapes[game.width * game.height];
            for (int i = height - 1; i >= 0; i--)
            {
                for (int columns = width - 1; (columns >= 0) && isComplete; columns--)
                {
                    if (!((Tiles_shapes)arrField[columns + i * width]).isBlock)
                    {
                        isComplete = false;
                    }
                }
                if (!isComplete)
                {
                    // copy the rows
                    for (int j = width - 1; j >= 0; j--)
                    {
                        array_for_blocks_creation[j + total_rows * width] = arrField[j + i * width];
                    }

                    total_rows--;
                    isComplete = true;
                }
                else
                {   // exclude rows that are completed.
                    count++;
                }
            }

            // get all the rows that are not completed.
            arrField = array_for_blocks_creation;
            EventArgs e = new EventArgs(count);

            isDone((object)this, e);
        }
Пример #4
0
 public void create_pic_field()
 {
     arrField = new Tiles_shapes[game.width * game.height];
 }