How to use the phaser-ce.Point function in phaser-ce

To help you get started, we’ve selected a few phaser-ce 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 amaccann / phaser-navmesh-generation / src / demo / demoState.js View on Github external
onUp(pointer) {
    const { navMesh, spriteGroup } = this;
    const isRightButton = pointer.rightButton.isDown;
    const { withinGame, worldX, worldY } = pointer;
    const paths = [];

    if (!withinGame || !isRightButton || !navMesh) {
      return;
    }

    const destination = new Point(worldX, worldY);
    spriteGroup.forEachAlive(sprite => {
      const { position, width, height } = sprite;
      const size = Math.max(width, height);
      const path = navMesh.getPath(position, destination, size);

      // If no path found, do nothing with the sprite
      if (!path) {
        return sprite.addPath([]);
      }

      paths.push(path);
      sprite.addPath(path);
    }, this);

    this.renderPaths(paths);
  }

phaser-ce

Phaser CE (Community Edition) is a fast, free and fun HTML5 Game Framework for Desktop and Mobile web browsers.

MIT
Latest version published 2 years ago

Package Health Score

59 / 100
Full package analysis