This site requires JavaScript, please enable it in your browser!
Greenfoot back
qwakery
qwakery wrote ...

2014/5/28

Help with board game rules

qwakery qwakery

2014/5/28

#
Hi, In my board game, if you roll a 4 on the dice, you choose one of your pieces to move back one space. This is not possible if both of your pieces are on the first space. I need to make it so that a boolean turns true when both your pieces cannot move. I already have a method which recognises that you have rolled a 4 on the first space but this only knows that one piece cant move. Basically, I have a non-static method called fourOnStart which knows if that object cannot move - there are 2 objects if each counter class. I need to have a variable called bothCannotMove which turns true when neither of the pieces can move. Help?
lordhershey lordhershey

2014/5/28

#
are you calling the test? do you have a cod snippit to look at?
qwakery qwakery

2014/5/28

#
I dont have a code snippet because I dont even know where to start! But pseudocode would like something like this: IF player1counter1 cant move & player1counter2 cant move THEN player1cannotmove = true
lordhershey lordhershey

2014/5/28

#
so what to do if both cannot move? Skip a turn?
qwakery qwakery

2014/5/28

#
It would skip a turn but I know how to do that bit.
You need to login to post a reply.