I'm attempting to create a chess game, for the movement I need to be able to click on a piece with the mouse, and then the square I'd like to move it to. Each piece on the board is a sprite, and I'm struggling to find a way to select a sprite in order to then move it, what would be the best way to do this? I'm programming in c# with XNA framework btw. Thanks in advance :)
1 Answer
\$\begingroup\$
\$\endgroup\$
I think the best way would be to make a rectangle for the position and hitbox of each of your chess pieces. After that make a rectangle for the mouse pointer, and use the Rectangle.Intersects method to check if your mouse hitbox intersects with one of the pieces hitboxes, and of course do your logic there.