wood burning stoves 2.0*
The moose likes Swing / AWT / SWT and the fly likes Checkers Piece Movement Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Java » Swing / AWT / SWT
Bookmark "Checkers Piece Movement" Watch "Checkers Piece Movement" New topic
Author

Checkers Piece Movement

Sultan Ali
Greenhorn

Joined: Jul 21, 2011
Posts: 7
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

Joined: Jun 09, 2003
Posts: 4632
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.
 
Consider Paul's rocket mass heater.
 
subject: Checkers Piece Movement
 
Similar Threads
Draughts Board
checkers
recursion--need help pseudocoding/setting up
More succinct way to write this code?
Determining Pixel Colour