papercut said:
2) Only after a stone has been selected, the player then can klick on a part of the gameboard to move the stone to that position.
Look at HelloMousePick in the jmetest.TutorialGuide. Also look at wolfgang's code http://jmonkeyengine.com/forum/index.php?topic=9234.msg88037#msg88037
The first reference will give you a better fit for your game.
The second one will give you the ending position of where you want to move your playstone.
papercut said:
but im not sure where/how i could do the gamelogic
I stumbled upon one solution to your case when I was trying to do 2 separate things:
1. left mouse click to pick and highlight a target
2. right mouse click to rotate and travel to the clicked location
Well, you can use this
1. pick the target object with your code or the first above
2. 'grab' the target by identifying which mesh -> node; i'm using ogre mesh right now so I had to modify the OgreEntityNode so I could assign unique names to each node (I'm sure I'm doing it the hard way ;) )
3. pick the terrain using the second above to get the TriMesh to get the terrain pick location
4. translate the location of the target by assigning it to the TriMesh location
papercut said:
i thought of some simple variables like: boolean isPlaystonePicked
and so on. but is this the best approach?
I've always liked simplicity, but don't always get it. Maybe using one variable boolean isMyTurn.
Two ways to for it to be true.
1. You're player 1 at the start,
2. You're 'given' both the play stone location and the turn (i.e. player 2's isMyTurn=false, and yours becomes true)
When it's not you're turn, you could
if(!isMyTurn) {
// code telling you each time you click the stone that it's not your turn XD
}
receiveTurn() {
receivePlaystoneLocation();
setPlaystoneLocation();
isPlaystoneMovable = true;
}
giveUpTurn(){
sendPlaystoneLocation();
isPlaystoneMovable = false;
}
I think the isPlaystoneMovable is not needed because you can just use isMyTurn for control.