Hi guys, I’m having a problem using a plugin.
I’m using vue with phaser 3 and it’s working fine.
So I have 2 routes: Home and Map.
For the first time, when I go from Home to Map, the plugin load my map and I have no problem.
But if I back to Home, and click again in Map, I get this message:
PluginManager.js?98fe:361 Scene Plugin key in use: KineticScrollingPlugin
Here is my Map.vue
<template>
<div>
<div id="game-container"></div>
</div>
</template>
<script>
import Phaser from "phaser";
import KineticScrolling from "./KineticScrolling";
import BootScene from "./BootScene";
import PlayScene from "./PlayScene";
export default {
name: "TileMap",
destroyed() {
window.game.destroy(true);
},
mounted() {
window.game = new Phaser.Game({
type: Phaser.AUTO,
width: window.innerWidth,
height: window.innerHeight - 70,
parent: "game-container",
scene: [BootScene, PlayScene],
plugins: {
scene: [{
key: "KineticScrollingPlugin",
plugin: KineticScrolling,
mapping: "kineticScrolling"
}]
}
});
}
};
</script>
And here is my plygin:
import * as Phaser from "phaser";
export default class KineticScroll extends Phaser.Plugins.ScenePlugin {
constructor(scene, pluginManager) {
super(scene, pluginManager);
}
}
I’m not sure what’s is going on… anybody knows how to fix it?
Thanks