Skip to main content

Setting up the Game


After you have set up the basics, now it's time to set up the game.

script.js
const { Decimal, Game } = window.eMath;

// Initialize game with options
const gameOptions = {
// Name of the game (optional)
name: {
id: "coinGame", // ID of the game, used for saving and loading
name: "Coin Game", // Name of the game, cosmetic
version: "0.1.0", // Version of the game
},
};

const coinGame = new Game(gameOptions);

Explanation:

  • The Game class is imported from the eMath object. This class is used to create the game.
  • The gameOptions object is defined to store the game's name, ID, and version. For all options, see the Game documentation.

After this step, you can continue to the currency tutorial.