Exemplo n.º 1
0
        public void CurrTetriminoMoveRotate()
        {
            Point Position = currTetrimino.getCurrPosition();

            Point[] S     = new Point[4];
            Point[] Shape = currTetrimino.getCurrShape();
            bool    move  = true;

            Shape.CopyTo(S, 0);
            currTetriminoErase();
            for (int i = 0; i < S.Length; i++)
            {
                double x = S[i].X;
                S[i].X = S[i].Y * -1;
                S[i].Y = x;
                if (((int)((S[i].Y + Position.Y) + 2)) >= Rows)
                {
                    move = false;
                }
                else if (((int)(S[i].X + Position.X) + ((Columns / 2) - 1)) < 0)
                {
                    move = false;
                }
                else if (((int)(S[i].X + Position.X) + ((Columns / 2) - 1)) >= Columns)
                {
                    move = false;
                }
                else if (BlockControls[((int)(S[i].X + Position.X) + ((Columns / 2) - 1)), (int)(S[i].Y + Position.Y) + 2].Background != NoBrush)
                {
                    move = false;
                }
            }
            if (move)
            {
                currTetrimino.moveRotate();
                currTetriminoDraw();
            }
            else
            {
                currTetriminoDraw();
            }
        }