0.0.22 • Published 4 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
4 years ago
0.0.21
4 years ago
0.0.20
5 years ago
0.0.19
5 years ago
0.0.18
5 years ago
0.0.17
5 years ago
0.0.12
5 years ago
0.0.13
5 years ago
0.0.14
5 years ago
0.0.15
5 years ago
0.0.10
5 years ago
0.0.11
5 years ago
0.0.9
5 years ago
0.0.8
5 years ago
0.0.7
5 years ago
0.0.6
5 years ago
0.0.5
5 years ago
0.0.1
5 years ago