Movement (checkers tutorial) problem when moving more than one square per turn [Self-Resolved]
by Siobhan · in Torque Game Builder · 10/14/2010 (3:01 pm) · 1 replies
I'm just looking at the checkers tutorial and I was just messing with it a bit as a kind of practice for a different project I'm working on right now. I can get the checkers to move one square per turn but if I try increase that to 3 squares per turn the ServerChecker (Player1) moves once but then stays mounted to the mouse so it's never Player2's turn.
I didn't change much of the code at all. I just added a variable $movementPoints in the setTurn function and I give it the value 3. And then when the server/client calls the isLegalMove function in checkerboard.cs if it is a legal move I decrease $movementPoints appropriately.
Then in serverAttemptMovePiece in serverCheckers.cs I put an if statement around swapTurns like so...
I don't understand why Player1 won't dismount from the mouse. It's able to move one tile and that's it. if I try move it anymore then it just stays mounted to the mouse.
If anyone could help me out on this one I would be very grateful. If you need me to post actual code, I can do that.
I didn't change much of the code at all. I just added a variable $movementPoints in the setTurn function and I give it the value 3. And then when the server/client calls the isLegalMove function in checkerboard.cs if it is a legal move I decrease $movementPoints appropriately.
Then in serverAttemptMovePiece in serverCheckers.cs I put an if statement around swapTurns like so...
if($movementPoints == 0){
swapTurns();
}I don't understand why Player1 won't dismount from the mouse. It's able to move one tile and that's it. if I try move it anymore then it just stays mounted to the mouse.
If anyone could help me out on this one I would be very grateful. If you need me to post actual code, I can do that.
Siobhan
Default Studio Name