コード例 #1
0
        public void CurTetraminoMovRotate()
        {
            Point Position = curTetramino.GetPosition;

            Point[] S     = new Point[4];
            Point[] Shape = curTetramino.GetShape;
            bool    move  = true;

            Shape.CopyTo(S, 0);
            CurTetraminoErase();

            for (int i = 0; i < S.Length; i++)
            {
                int x = S[i].X;
                S[i].X = S[i].Y * -1;
                S[i].Y = x;

                if (((int)((S[i].Y + Position.Y) + 1)) >= rows)
                {
                    move = false;
                }

                else if (((int)(S[i].X + Position.X) + ((cols / 2) - 1)) < 0)
                {
                    move = false;
                }

                else if (((int)(S[i].X + Position.X) + ((cols / 2) - 1)) >= cols)
                {
                    move = false;
                }

                else if (BlockControls[((int)(S[i].X + Position.X) + ((cols / 2) - 1)),
                                       (int)(S[i].Y + Position.Y) + 1].BackgroundImage != NoImage)
                {
                    move = false;
                }
            }
            if (move)
            {
                curTetramino.MovRotate();
                CurTetraminoDraw();
            }
            else
            {
                CurTetraminoDraw();
            }
        }