Example #1
0
        // Used to move the brick
        protected void MoveBrick(int y, int x)
        {
            if ((y != yLast) || (x != xLast))
            {
                if ((ChessMap.CheckMoveArray(x, y, '*')) || (ChessMap.CheckMoveArray(x, y, '#')))
                {
                    // Pawn rule when touching the edge of the map
                    if ((y == 0) && (brickStore == 'A'))
                    {
                        brickStore = 'E';
                    }
                    if ((y == 7) && (brickStore == 'a'))
                    {
                        brickStore = 'e';
                    }

                    int brickCounter = 0;
                    if (ChessMap.CheckMoveArray(x, y, '#'))
                    {
                        brickCounter = 1;
                        if (ChessMap.enableSound == true)
                        {
                            snd_click02.Play();
                        }
                    }
                    else if (ChessMap.enableSound == true)
                    {
                        snd_click01.Play();
                    }

                    ChessMap.SetMapArray(x, y, brickStore);
                    ChessMap.SetMoveArray(x, y, ' ');
                    ChessMap.SetMapArray(xLast, yLast, ' ');
                    brickStore = '!';

                    // Changes the brick team
                    TeamChange(brickCounter);
                }
                ChessMap.brickSelected = false;
            }
        }
Example #2
0
 // Used clear all brick markers
 protected void ClearBrickMarker()
 {
     for (int y = 0; y < 8; y++)
     {
         for (int x = 0; x < 8; x++)
         {
             if (ChessMap.brickSelected == false)
             {
                 if (ChessMap.CheckMoveArray(x, y, '*'))
                 {
                     ChessMap.SetMoveArray(x, y, ' ');
                     ChessMap.SetMapArray(x, y, ' ');
                 }
                 if (ChessMap.CheckMoveArray(x, y, '#'))
                 {
                     ChessMap.SetMoveArray(x, y, ' ');
                 }
             }
         }
     }
 }