How To Limit Time Of A Player's Turn In A Socket.io Game?
I'm trying to make a simple text turn-based game in node.js using the socket.io module. The player must have a timeout to send the text during his turn. If he fails to do so, he lo
Solution 1:
When you receive a move, you can cancel the current timer with clearTimeout(timer)
.
Then after you've processed that player's move, just call advancePlayer()
from your move handler code. This will advance to the next player and set a new timer.
Post a Comment for "How To Limit Time Of A Player's Turn In A Socket.io Game?"