Hi, I need to switch between the two players of my game, so when they click on the go button the value of a dice is sent into the the label, but it needs to take turns. I have tried using while and if statements to do this but nothing is working, instead when the button is clicked it sends the values at the same time. I want it to do Player 1 first then Player 2. Help!
Switching players
Started by Alex_j, May 06 2010 07:47 AM
1 reply to this topic
#1
Posted 06 May 2010 - 07:47 AM
|
|
|
#2
Posted 07 May 2010 - 03:21 PM
I think a solution cloud be a bool instance variable, in you main class.
When the payer1's turn set it to true, when player2's turn set it to false, and do the checking each time you click the button.
Or if you have a player class, create a static instace variable, witch is shared by all the objects created from that class.
I hope I cloud help you :)
When the payer1's turn set it to true, when player2's turn set it to false, and do the checking each time you click the button.
Or if you have a player class, create a static instace variable, witch is shared by all the objects created from that class.
I hope I cloud help you :)


Sign In
Create Account


Back to top









