How to use the colyseus.generateId function in colyseus

To help you get started, we’ve selected a few colyseus examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github colyseus / colyseus-unity3d / Server / DemoRoom.ts View on Github external
populateEnemies () {
    for (let i=0; i<=3; i++) {
      const enemy = new Enemy();
      enemy.x = Math.random() * 2;
      enemy.y = Math.random() * 2;
      this.state.entities[generateId()] = enemy;
    }
  }