Sign In Register

How can we help you today?

Start a new topic
Answered

hearthstone style scheduling

I'm trying to create a hearthstone style of handling turns.


Basically, the game is turn-based but with a time limit on how long a turn can take. A user get's say, 45 seconds to until the timer ends their turn. They can also force complete which activates the other players turn.


Illustrated below.



I tried using the SparkScheduler but it doesnt seem to work when being called from a module that was called from SparkScheduler. Is there any way around this to make this style of game?


Best Answer

Hi One More Turn,


You could use the User ChallengeTurnTakenMessage Cloud Code to trigger the 45 second scheduled timer as one of these is sent when a turn is taken, at the end of which you can use SparkChallenge to consume the players turn ("Spark.getChallenge(mychallengeid).consumeTurn(playerId);") and pass it to the the player. If the turn is submitted within the 45 second time frame, cancel the scheduler. Does that make sense ? Let me know if you have any further questions.


Thanks,

Liam


1 person has this question

Answer

Hi One More Turn,


You could use the User ChallengeTurnTakenMessage Cloud Code to trigger the 45 second scheduled timer as one of these is sent when a turn is taken, at the end of which you can use SparkChallenge to consume the players turn ("Spark.getChallenge(mychallengeid).consumeTurn(playerId);") and pass it to the the player. If the turn is submitted within the 45 second time frame, cancel the scheduler. Does that make sense ? Let me know if you have any further questions.


Thanks,

Liam

Would using consumeTurn free up the scheduler limit?

Login to post a comment