Skip to content

Unable to use plugins #13

Open
Open
@TomYeoman

Description

@TomYeoman

Describe the bug

Loving the project so far, thanks for keeping it up to date. I may be missing something but it seems plugins are not working for now -

Using the following code -

require("@geckos.io/phaser-on-nodejs");
import Phaser from "phaser";
import PhaserMatterCollisionPlugin from "phaser-matter-collision-plugin";

// @ts-ignore
import { phaserGameConfig, serverFPS } from "../../../common/config/phaserConfig";
global.phaserOnNodeFPS = serverFPS; // default is 60

// prepare the config for Phaser
const config = {
  ...phaserGameConfig,
  type: Phaser.HEADLESS,
  audio: false,
  fps: {
    target: serverFPS,
    forceSetTimeOut: true,
  },
  plugins: {
    scene: [
      {
        plugin: PhaserMatterCollisionPlugin, // The plugin class
        key: "matterCollision", // Where to store in Scene.Systems, e.g. scene.sys.matterCollision
        mapping: "matterCollision" // Where to store in the Scene, e.g. scene.matterCollision
      }
    ]
  }
};

export default config;

I then use in the scene as such -


      //@ts-ignore
      console.log(this.scene.matterCollision);
      //@ts-ignore
      this.scene.matterCollision.addOnCollideActive({
        objectA: bot,
        objectB: [Object.entries(this.playerSystem.playerGraphics)],
        callback: ({ gameObjectA, gameObjectB }: any) => {
          console.log("COLLISSSION ALLLEEERRTTTT");
        },
      });

However review the following error -

image

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions