Exemplo n.º 1
0
        /// <summary>
        /// テトリミノを左に移動させてたときの処理
        /// </summary>
        public void CurrentTetriminoMoveLeft()
        {
            Point position = _currentTetrimino.GetCurrentPosition();

            Point[] Shapes = _currentTetrimino.GetCurrentShape();
            bool    move   = true;

            CurrentTetriminoErase();
            foreach (Point Shape in Shapes)
            {
                if ((int)(Shape.X + position.X) + (((Cols / 2) - 1) - 1) < 0)
                {
                    move = false;
                    break;
                }
                else if (BlockControls[((int)(Shape.X + position.X) + ((Cols / 2) - 1) - 1),
                                       (int)(Shape.Y + position.Y) + 2].Background != NoBrush)
                {
                    move = false;
                    break;
                }
            }

            if (move)
            {
                _currentTetrimino.MoveLeft();
                CurrentTetriminoDraw();
            }
            else
            {
                CurrentTetriminoDraw();
            }
        }
Exemplo n.º 2
0
        public void CurrentTetraminoMoveLeft()
        {
            var position = _currentTetramino.GetCurrentPosition();
            var shape    = _currentTetramino.GetCurrentShape();
            var move     = true;

            CurrentTetraminoErase();
            foreach (var point in shape)
            {
                if (((int)(point.X + position.X) + ((_cols / 2) - 1) - 1) < 0)
                {
                    move = false;
                }
                else if (
                    !Equals(_blockControls[
                                ((int)(point.X + position.X) + ((_cols / 2) - 1) - 1), (int)(point.Y + position.Y) + 2]
                            .Background, NoBrush))
                {
                    move = false;
                }
            }

            if (move)
            {
                _currentTetramino.MoveLeft();
                CurrentTetraminoDraw();
            }
            else
            {
                CurrentTetraminoDraw();
            }
        }
Exemplo n.º 3
0
        /// <summary>
        /// Фигуру влево
        /// </summary>
        public void CurentTetraminoMoveLeft()
        {
            Point pos = currentTetramino.Position;

            Point[] figure  = currentTetramino.Cells;
            bool    canMove = true;

            TetrisField.TetraminoErase(currentTetramino);
            foreach (Point P in figure)
            {
                // не можем сдвинуть влево - у левой границы поля
                if (((int)(P.X + pos.X) + ((TetrisField.columns / 2) - 1) - 1) < 0)
                {
                    canMove = false;
                }
                // не можем влево - слева стоит фигура
                else if (TetrisField.Field[((int)(P.X + pos.X) + ((TetrisField.columns / 2) - 1) - 1),
                                           (int)(P.Y + pos.Y)].Fill != GridField.fieldBrush)
                {
                    canMove = false;
                }
            }
            if (canMove)
            {
                currentTetramino.MoveLeft();
            }
            TetrisField.TetraminoDraw(currentTetramino);
        }