0.0.22 • Published 5 years ago
@runox-game/game-engine v0.0.22
Runox-Game-Engine
Example
const game = new GameEngine();Methods of GameEngine
- start
game.start().subscribe(
() => {},
(error: string) => {
// handle error
}
);Also, you can use different game modes passing a GameModes object as parameter (by default all game modes are deactivated)
const gameModes: GameModes = {
randomTakeDeckCard: false,
cumulativePlusTwo: false,
dedicatePlusFour: false,
crazyCommands: false,
};
game.start(gameModes).subscribe(
() => {},
(error: string) => {
// handle error
}
);game.start().subscribe(
() => {},
(error: string) => {
// handle error
}
);- reset
game.reset().subscribe(
() => {},
(error: string) => {
showErrorAlert(error);
}
);- reset
game.reset().subscribe(
() => {},
(error: string) => {
showErrorAlert(error);
}
);- join
game.join([user]).subscribe();- remove
game.remove(user).subscribe();- playCard
game.playCard(game.playerTurn?.id, card).subscribe();- takeCard
game.takeCard();- takeCardToRandomPlayer
game.takeCardToRandomPlayer();- uno
game.uno(user.id);- switchHands
game.switchHands(player1, player2);- overrideInternalState
game.overrideInternalState(_data);- logs
LogLevel.ALL LogLevel.USER LogLevel.BEFORE_COMMAND LogLevel.AFTER_COMMAND LogLevel.BEFORE_VALIDATION LogLevel.AFTER_VALIDATION
game.logs(LogLevel.USER).subscribe((log: ILog) => {
console.log(log);
});- onSpecialCardPlayed Special for play special sound
game.onSpecialCardPlayed().subscribe((card: ICard) => {
console.log(card);
});- onCardPlayed
game.onCardPlayed().subscribe((card: ICard) => {
console.log(card);
});- onStateChanged
game.onStateChanged().subscribe((state: IGameState) => {
console.log(state);
});0.0.22
5 years ago
0.0.21
5 years ago
0.0.20
6 years ago
0.0.19
6 years ago
0.0.18
6 years ago
0.0.17
6 years ago
0.0.12
6 years ago
0.0.13
6 years ago
0.0.14
6 years ago
0.0.15
6 years ago
0.0.10
6 years ago
0.0.11
6 years ago
0.0.9
6 years ago
0.0.8
6 years ago
0.0.7
6 years ago
0.0.6
6 years ago
0.0.5
6 years ago
0.0.1
6 years ago