Rose Game Solutions Posted December 12, 2018 Share Posted December 12, 2018 I'm not understanding how to incorporate plugins... especially for matter-attractors. my config file looks like this, I'm bringing in another plugin that worked well, and had good instructions. type: Phaser.AUTO, parent: "my game", canvas: document.getElementById("game"), width: 1500, // window.innerWidth height: 1500, // window.innerHeight pixelArt: true, roundPixels: true, physics: { default: "matter", matter: { gravity: { scale: 0 }, debug: 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 }, { plugin: MatterAttractors, key: "matterAttractors", mapping: "matterAttractors", }, ], }, }; You can see I'm trying to use it there at the bottom... I'm not having any luck. I'm expecting to see them in the console when they get in by using this: this.plugins.scenePlugins I'm hoping someone call show me what needs to change. here is matter-atractor's github link Quote Link to comment Share on other sites More sharing options...
rich Posted December 12, 2018 Share Posted December 12, 2018 The Matter Attractors plugin is already built-in, you just need to specify it in the Scene config. There's an example for it here: http://labs.phaser.io/view.html?src=src\physics\matterjs\attractors.js Quote Link to comment Share on other sites More sharing options...
Rose Game Solutions Posted December 13, 2018 Author Share Posted December 13, 2018 Thanks @rich. I'm still having trouble getting the matter-attractors plugin working... i'm using es6 classes with webpack and my entry point file looks like this: import "phaser"; import config from "./config"; import GameScene from "./Game"; import BootScene from "./Boot"; class Game extends Phaser.Game { constructor() { super(config); this.scene.add("Boot", BootScene); this.scene.add("Game", GameScene); this.scene.start("Boot"); } } window.game = new Game(); window.addEventListener("resize", event => { window.game.resize(window.innerWidth, window.innerHeight); }); Any thoughts on what I might check? my updated config file: export default { type: Phaser.AUTO, parent: "TESTING", canvas: document.getElementById("game"), width: 600, height: 400, pixelArt: true, roundPixels: true, physics: { default: "matter", matter: { gravity: { scale: 0 }, debug: true, }, plugins: { attractors: true, }, }, }; Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.