Hi, I get the error: undefined is not an object (evaluating ‘scene.matter.world’) when I’m trying to make a custom Matter sprite in Es6.
I don’t know why it’s happening, can someone help me?
File 1
class Sprite extends Phaser.Physics.Matter.Sprite {
constructor(scene, x, y, texture) {
super(scene.matter.world, x, y, texture);
scene.add.existing(this)
}
preUpdate(time, delta) {
super.preUpdate(time, delta);
}
}
File 2
this.sprite = new Sprite({
scene: this,
x: 10,
y: 10,
texture: 'my-texture-key'
});
Also my Matter config is correctly set!