@enzo_corsico/times-up-game
v1.0.7
Published
Times up game
Downloads
1
Readme
Table of Contents
Install
$ npm install @enzo_corsico/times-up-game
Once the package is installed, you can import the library using import
approach :
import { TimesUp } from '@enzo_corsico/times-up-game';
Example
import { TimesUp } from '@enzo_corsico/times-up-game';
const timesUp = new TimesUp();
// Let's add some Words
timesUp.setWords(["Word 1", "Word 2", "Word 3"]);
// Let's add some Players
timesUp.setPlayers([
{
name: "Player 1",
score: 0,
team: 1
},
{
name: "Player 2",
score: 0,
team: 1
},
{
name: "Player 3",
score: 0,
team: 2
},
{
name: "Player 4",
score: 0,
team: 2
}
]);
Words
Get the words
timesUp.getWords(); // ["Word 1", "Word 2", "Word 3"]
Set the words
timesUp.setWords(["Word 1", "Word 2", "Word 3"]);
Add one word
timesUp.addWord("Word to add");
Delete one word
timesUp.removeWord("Word 1");
Players
Get the players
timesUp.getPlayers(); // [ // { // name: "Player 1", // score: 0, // team: 1 // }, // { // name: "Player 2", // score: 0, // team: 1 // }, // { // name: "Player 3", // score: 0, // team: 2 // }, // { // name: "Player 4", // score: 0, // team: 2 // } // ]
Set the players
timesUp.setPlayer([ { name: "Player 1", score: 0, team: 0 } ]);
Add one player
timesUp.addPlayer({ name: "Player 2", score: 0, team: 0 });
Remove one player
timesUp.removePlayer({ name: "Player 2", score: 0, team: 0 });
Rounds
Get round number
timesUp.getRound(); // 1
Set round number
timesUp.setRound(1);
Next round
// Increment the current round by one timesUp.nextRound();