This project is read-only.

Capturing a piece


Current UI design is that each chess piece UIelement is on a block rectangle element. It causes an issue where when when a player tries to capture an opponent piece, he has to click on the block, not the image of a piece.

This issue should be resolved so that a player can capture an opponent piece by clicking on a piece, too.


shane77m wrote Oct 8, 2013 at 2:08 AM

How about something along the lines of moving the chesspiece behind the chessblock? It is not the prettiest solution.

private Rectangle InitializeGameGrid(int row, int column)
        Rectangle newRectangle = new Rectangle();

        // If the Chess board that contains the chess piece is marked available for move
        if (ChessGameModel.ChessBoard.ChessBoard[row, column].IsAvailableForMove == true)
            // Add a click event
            newRectangle.Fill = Brushes.Coral;
            newRectangle.SetValue(Canvas.ZIndexProperty, 1);
            newRectangle.Opacity = .5;               
            newRectangle.MouseLeftButtonDown += OnRectangleClick;

        return newRectangle;