How do I know on the cloud who's turn it is? The client API has a nextPlayer field. What should I be using on the cloud?
Best Answer
C
Customer Support
said
over 6 years ago
Hi Vince,
You can't get the nextPlayer in SparkChallenge I'm afraid. You can use Spark.getData().nextPlayer in ChallengeTurnTakenMessage or in the ChallengeStartedMessage. What exactly are you trying to achieve here ? Let me know and we'll help you find a solution.
You can't get the nextPlayer in SparkChallenge I'm afraid. You can use Spark.getData().nextPlayer in ChallengeTurnTakenMessage or in the ChallengeStartedMessage. What exactly are you trying to achieve here ? Let me know and we'll help you find a solution.
Thanks,
Liam
V
Vince Jewlal
said
over 6 years ago
I'm trying to setup the initial game state. When the challenge starts, I'd like the cloud to know the order of the players and who is to act first. Is the global ChallengeStartedMessage the right place to do this? Spark.getData().nextPlayer returns null/undefined.
Customer Support
said
over 6 years ago
Hi Vince,
The following will get the nextPlayer in the ChallengeStartedMessage.
var nextPlayer = Spark.getData().challenge.nextPlayer
Thanks,
Liam
C
Chris Brooks
said
about 4 years ago
Hello,
I have 4+ players and I would like to list information about them in turn order in the UI along with an indicator of whose turn it is. I see the next player field but how do I get a list of players in turn order?
Thanks,
Chris
2 people like this
S
Sahil Mahajan
said
almost 4 years ago
Hey,
Is there any way to get an order of turns for any challenge in the case of 5 players?
Vince Jewlal
https://docs.gamesparks.net/documentation/cloud-code-api/spark-cloud-code-api/sparkchallenge
How do I know on the cloud who's turn it is? The client API has a nextPlayer field. What should I be using on the cloud?
Hi Vince,
You can't get the nextPlayer in SparkChallenge I'm afraid. You can use Spark.getData().nextPlayer in ChallengeTurnTakenMessage or in the ChallengeStartedMessage. What exactly are you trying to achieve here ? Let me know and we'll help you find a solution.
Thanks,
Liam
- Oldest First
- Popular
- Newest First
Sorted by Oldest FirstCustomer Support
Hi Vince,
You can't get the nextPlayer in SparkChallenge I'm afraid. You can use Spark.getData().nextPlayer in ChallengeTurnTakenMessage or in the ChallengeStartedMessage. What exactly are you trying to achieve here ? Let me know and we'll help you find a solution.
Thanks,
Liam
Vince Jewlal
I'm trying to setup the initial game state. When the challenge starts, I'd like the cloud to know the order of the players and who is to act first. Is the global ChallengeStartedMessage the right place to do this? Spark.getData().nextPlayer returns null/undefined.
Customer Support
Hi Vince,
The following will get the nextPlayer in the ChallengeStartedMessage.
Thanks,
Liam
Chris Brooks
Hello,
I have 4+ players and I would like to list information about them in turn order in the UI along with an indicator of whose turn it is. I see the next player field but how do I get a list of players in turn order?
Thanks,
Chris
2 people like this
Sahil Mahajan
Hey,
Is there any way to get an order of turns for any challenge in the case of 5 players?
-
Documentation Notes
-
Design issues with user events
-
Using NoSQL
-
Runtime Collections vs Metadata Collections
-
Anonymous authentication from browser app
-
Modules
-
Movement With Unity
-
Problem with url parameters for downloadables
-
Querying NoSql GameSparks database
-
Challenge accesType
See all 2487 topics