Programming C, C++, Java, PHP, Ruby, Turing, VB
Computer Science Canada 
Programming C, C++, Java, PHP, Ruby, Turing, VB  

Username:   Password: 
 RegisterRegister   
 Checkers movement/selection help
Index -> Programming, Java -> Java Help
View previous topic Printable versionDownload TopicSubscribe to this topicPrivate MessagesRefresh page View next topic
Author Message
Talion




PostPosted: Fri May 25, 2007 11:28 am   Post subject: Checkers movement/selection help

Ok so for our Final Project in Gr 12 compsci we're working in groups of three to create a simple game. My group chose to create Checkers. However the problem is our teacher hasn't taught us java as well as she should of so we're not sure how to proceed. As the groups leader I'm the only one actually thinking ahead and so I'm saving myself a lot of trouble and pain now and asking how to make the checkers pieces move.

Again i'm not that skilled with Java so i'm not sure how well my idea's will work and i'm more then open to suggestions, other methods...anything.

Essentially the idea we have right now is that since there are two teams, and approx 20 pieces for each player it's most efficient to have an array for each players pieces. This way all their data can be stored in a smaller amount of space. My issue though with this is how do you select which individual piece moves? Making the piece move, even the jumping and multiple jumping for now isn't an issue at all for me. for now my only goal is to figure out how to select the piece and make it move.

I don't know how simple this can be. The teacher wants mouseclick to be used to select the piece and a mouse click to be used to select the square you want to move to. I don't know how to use the mouse click to select the piece. I'm not sure how i'm supposed to get the mouseclick to register with an individual piece and im not sure once it's selected if moving it is as simple as simply modifying the x y comps or if there should be an array of x y comps, relating to each piece and those get modified.

I don't even know if what i've said makes sense but hopefully it does. to sum it up I need to figure out how to use mouse click to select an individual checker piece out of an array and then whether or not it's easier to have individual x y comp movements for each piece or have them all in an array together.

:S Hopefully someone can help me out here! Again i'm not skilled with Java so any help no matter how trivial would be useful! Especially if the way i'm looking at this is all wrong, or if there's a better way to select and move the pieces then mouseclick!

Thanks,

Talion

P.s. This project is currently entirely in the planning stage as we just started working on it yesterday so I have no code at this time to offer as to what I have...simply using this for some assistance. Razz
Sponsor
Sponsor
Sponsor
sponsor
OneOffDriveByPoster




PostPosted: Sat May 26, 2007 5:17 pm   Post subject: Re: Checkers movement/selection help

You can consider a grid (2-D array) of pieces to represent your board. You can display your board using Swing/AWT. Have a listener for the appropriate mouse events and translate a click in some position to a click on a square in your grid.
Display posts from previous:   
   Index -> Programming, Java -> Java Help
View previous topic Tell A FriendPrintable versionDownload TopicSubscribe to this topicPrivate MessagesRefresh page View next topic

Page 1 of 1  [ 2 Posts ]
Jump to:   


Style:  
Search: