0.0.22 • Published 4 years ago

@runox-game/game-engine v0.0.22

Weekly downloads
-
License
ISC
Repository
github
Last release
4 years ago

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

4 years ago

0.0.19

4 years ago

0.0.18

4 years ago

0.0.17

4 years ago

0.0.12

4 years ago

0.0.13

4 years ago

0.0.14

4 years ago

0.0.15

4 years ago

0.0.10

4 years ago

0.0.11

4 years ago

0.0.9

4 years ago

0.0.8

4 years ago

0.0.7

4 years ago

0.0.6

4 years ago

0.0.5

4 years ago

0.0.1

5 years ago