Exemple #1
0
 //
 //	Method: GetRotateShape(),
 //
 private void GetRotateShape(ShapeRotateEnum r)
 {
     try
     {
         if (r == ShapeRotateEnum.RotateClockwise)
         {
             m_Shapes.Rotate(r);
             m_intShape = m_Shapes.GetShape();
         }
         else if (r == ShapeRotateEnum.RotateCounterClockwise)
         {
             m_Shapes.Rotate(r);
             m_intShape = m_Shapes.GetShape();
         }
     }
     catch
     {
         MessageBox.Show("GetRotateShape(), bad stuff happening!");
     }
 }
Exemple #2
0
        private bool IsMoveValid(int x, int y, ShapeRotateEnum r)
        {
            int NextRow = m_intCurrentRow + x;
            int NextCol = m_intCurrentCol + y;

            // remove current object
            XorShape();

            // rotate shape if requested
            if (r != ShapeRotateEnum.RotateNone)
            {
                GetRotateShape(r);
            }

            // check for collision
            if (Collision(NextRow, NextCol))
            {
                // if so restore shape and return failed
                if (r == ShapeRotateEnum.RotateClockwise)
                {
                    // reverse clockwise
                    GetRotateShape(ShapeRotateEnum.RotateCounterClockwise);
                }
                else if (r == ShapeRotateEnum.RotateCounterClockwise)
                {
                    // reverse counterclockwise
                    GetRotateShape(ShapeRotateEnum.RotateClockwise);
                }

                // put shape back in well
                XorShape();
                return(false);
            }

            // ok to move
            return(true);
        }
Exemple #3
0
        private bool IsMoveValid(int x, int y, ShapeRotateEnum r)
        {
            int NextRow = m_intCurrentRow + x;
            int NextCol = m_intCurrentCol + y;

            // remove current object
            XorShape();

            // rotate shape if requested
            if (r != ShapeRotateEnum.RotateNone)
            {
                GetRotateShape(r);
            }

            // check for collision
            if (Collision(NextRow, NextCol))
            {
                // if so restore shape and return failed
                if (r == ShapeRotateEnum.RotateClockwise)
                {
                    // reverse clockwise
                    GetRotateShape(ShapeRotateEnum.RotateCounterClockwise);
                }
                else if (r == ShapeRotateEnum.RotateCounterClockwise)
                {
                    // reverse counterclockwise
                    GetRotateShape(ShapeRotateEnum.RotateClockwise);
                }

                // put shape back in well
                XorShape();
                return false;
            }

            // ok to move
            return true;
        }
Exemple #4
0
 //
 //    Method: GetRotateShape(),
 //
 private void GetRotateShape(ShapeRotateEnum r)
 {
     try
     {
         if (r == ShapeRotateEnum.RotateClockwise)
         {
             m_Shapes.Rotate(r);
             m_intShape = m_Shapes.GetShape();
         }
         else if (r == ShapeRotateEnum.RotateCounterClockwise)
         {
             m_Shapes.Rotate(r);
             m_intShape = m_Shapes.GetShape();
         }
     }
     catch
     {
         MessageBox.Show("GetRotateShape(), bad stuff happening!");
     }
 }