Win a copy of Re-engineering Legacy Software this week in the Refactoring forum
or Docker in Action in the Agile forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Checkers Piece Movement

 
Sultan Ali
Greenhorn
Posts: 7
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi everyone, I'm working on a checkers game, i have problem with piece movements, currently i have few classes which i will upload, but my main problem is that i can't move my piece to a new location within the board, I have it so that when a piece is clicked it position is checked, and the mouse listens to a new square that user clicks, if the square doesn't have a piece on it then a Boolean is set to true.
I really need an advice help of how i could go about moving the pieces to a new location within the board.

 
Michael Dunn
Ranch Hand
Posts: 4632
  • Likes 1
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
one of the ways would be to have your board made up of JLabels, and the checkers as images/icons.

then, after your mouseclicks/move validation, you set the icon of the old label to null, and the
label of new location to that of the old label's icon.
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic