x


Make priority for players

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?

Any ideas will be appreciated. thanks

more ▼

asked Jan 15 '12 at 04:18 PM

sanamdehghan gravatar image

sanamdehghan
46 14 21 23

(comments are locked)
10|3000 characters needed characters left

1 answer: sort voted first

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;
}
}

alright I hope this helps!

more ▼

answered Jan 15 '12 at 04:45 PM

Posly gravatar image

Posly
376 34 41 44

Thanks for your help. :)

Jan 15 '12 at 05:10 PM sanamdehghan

There is another problem now. This works fine with the server, but it looks like that the client doesn't get the updates counter, so the never could throw dice, and server can throw dice just once. Do you have any ideas how to fix it?

Jan 15 '12 at 06:09 PM sanamdehghan
(comments are locked)
10|3000 characters needed characters left
Your answer
toggle preview:

Up to 2 attachments (including images) can be used with a maximum of 524.3 kB each and 1.0 MB total.

Follow this question

By Email:

Once you sign in you will be able to subscribe for any updates here

By RSS:

Answers

Answers and Comments

Topics:

x804
x708

asked: Jan 15 '12 at 04:18 PM

Seen: 310 times

Last Updated: Jan 15 '12 at 06:09 PM