Hi;
I’m developing an online board game. In the game there is a dice button that when a player clicks it the s/he throws dice. Now I want to implement a function so it gives priority to the players so each player each time can clicks this button once. And s/he should wait until her turn comes again. Any ideas how to do this?
I’d use something like a counter, you add one to the counter everytime the player clicks the button, and when the counter reaches it’s max number, lets say 5, it subtracts 5 and starts the cycle all over again. Here’s an example:
var counter : int = 0;
function Update (){
if(counter = 0)
{
"now it's player one's turn"
}
if(counter = 1)
{
"now it's players two's turn"
}
if(counter = 2)
{
"now it's player three's turn"
}
if("the dice is rolled")
{
counter += 1;
}
if(counter == 2)
{
counter -= 2;
}
}