Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

@runox-game/game-engine

Package Overview
Dependencies
Maintainers
2
Versions
18
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@runox-game/game-engine

RunoX game engine

  • 0.0.22
  • latest
  • Source
  • npm
  • Socket score

Version published
Maintainers
2
Created
Source

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);
});

Keywords

FAQs

Package last updated on 28 Aug 2020

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc