Rose Game Solutions

  • Content Count

  • Joined

  • Last visited

Everything posted by Rose Game Solutions

  1. How do you add collision detection in matter physics, especially world bounds collision?
  2. Rose Game Solutions

    collision detection: world bounds and matter physics

    I included phaser-matter-collision-plugin npm package info for matter-collision: Then, in my scene, I passed an array containing all the walls of the world bounds... like so: // 'this' refers to Phaser.Scene const { bottom, left, top, right } =; this.matterCollision.addOnCollideStart({ objectA: [bottom, left, right, top], //world bounds objectB: this.gate, // some object to detect collision with callback: eventData => { // run logic here console.log(eventData) }, });
  3. I Have two scenes running. the topmost to the user cannot display a Sprite. Instead there is just a green box graphic displayed. I'm using the GameObjects.Sprite class and importing the same class and animations runs fine in the lower Scene. The config is set to Matter Physics. The Sprite will display and run in the lower scene. I think this might be a bug...
  4. 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
  5. Rose Game Solutions

    Plugins Phaser 3 matter.js matter-attractors

    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"); } } = new Game(); window.addEventListener("resize", event => {, 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, }, }, };
  6. Rose Game Solutions

    using multiple scenes

    I'm using multiple scenes and trying to get a Heads Up Display (HUD) that is always active. I'm also using a sprite with anims. however, when I load the sprite into the scene, I get an error coming from animation. here's my HUD class: export default class HUDScene extends Phaser.Scene { constructor() { super({ key: "HUD", active: true }); } and in my create method I'm just doing a simple constructor call this.HUD = new HUD(, 0, 0); Is there another way to accomplish this? or, what am I missing/doing wrong? the animations work in my 'gameScene' but not in the -always active- HUD scene... Thanks!
  7. Rose Game Solutions

    Phaser 3 : set timer event one more time after fireing

    I have the same question: Are timers meant to be restarted? if not, what methods should I look at if I want a timer that runs the whole game but not as fast as the update()?
  8. Rose Game Solutions

    matter.js and setting world bounds

    I'm actually still managing to slip out of the corners... any suggestions on how to address that?
  9. Rose Game Solutions

    matter.js and setting world bounds

    I increased the thickness and some of the body properties using setMass(<value>) setFriction(<value>, <air>) those combined with the bounds thickness seem to hold all high velocity objects inside it.
  10. Rose Game Solutions

    matter.js and setting world bounds

    in my scene's create method I'm using this line of code to set bounds., 0, 1800, 1800, 15); here, the thickness, is set to 15 as I understand it. But I fly through the walls sometimes and need a more solid barrier. any ideas on how to shore up the world bounds? Alternatively if you know of a way of setting tiles along the world bounds, I'd be fine with that kind of solution...