new GameData(numberRounds, currentRound, maxPlayers, players, playerData, prompt, drawer, timerID, timerValue)
Creates an instance of an GameSession to track data about the current game session
Parameters:
Name | Type | Description |
---|---|---|
numberRounds |
number | The number of rounds selected for the game |
currentRound |
number | The current round for the game |
maxPlayers |
number | The maximum number of players allowed to join the game |
players |
string | An array of avatars currently in game |
playerData |
Map | Game data associate to individual players such as score and current guess |
prompt |
object | The prompt for drawers to draw and guessers to guess |
drawer |
string | The currently selected drawer |
timerID |
number | The ID related to the timer interval for the room |
timerValue |
number | The current value of the round timer |
- Source:
Methods
allGuessesCorrect()
Check all guesses, return true if all are correct, return false if there are no correct guesses
- Source:
Returns:
true if all guesses are correct, false if any guesses are incorrect
clearGuesses()
Clears all user guesses and updates each user in the room
- Source:
getPath(promptObject)
Form the file path for the prompt image
Parameters:
Name | Type | Description |
---|---|---|
promptObject |
object |
- Source:
Returns:
path to prompt image
getPromptObject()
Randomly selects a prompt from the prompt list
- Source:
Returns:
the selected prompt
startNewRound(server, room)
Start new round in specified room
Parameters:
Name | Type | Description |
---|---|---|
server |
SocketServer | Socket.io server instance |
room |
number | Socket.io room |
- Source:
updateTimer(server, room)
Update timer value when called.
Parameters:
Name | Type | Description |
---|---|---|
server |
SocketServer | Socket.io server instance |
room |
number | Socket.io room |
- Source: