Hi, I am using phaser 3 through npm (https://www.npmjs.com/package/phaser)
It says there is Spine Plugin support, and I can see the plugin in phaser/plugins folder in node_modules along with camera3d, and fbinstant.
For phaser I use it by importing it as
import Phaser from ‘phaser’;
But how do I import or use that particular spine plugin? It doesn’t seem as a part of phaser import?
I am new with npm.
From examples it seems to load the plugin as a single file called ‘SpinePlugin.js’
Just trying to figure out how to import the spine plugin from the phaser module.
2nd issue (for the single js way):
I tried loading using SpinePlugin.js or SpinePlugin.min.js
Nothing works, got this.load.spine or this.spine undefined (inside a scene class)
Import it as
import * as SpinePlugin from './plugins/SpinePlugin.min.js';
And load it
const game = new Phaser.Game(
{
type: Phaser.AUTO,
width: GAMEPLAY.WIDTH,
height: GAMEPLAY.HEIGHT,
backgroundColor: '#000000',
parent: 'gameContent',
plugins:
{
global: [
/* { key: 'SpinePlugin', plugin: window.SpinePlugin, mapping: 'spine' }*/
]
},
scene: [BootScene, PreloadScene, TitleScene, GameScene, { key: 'SpinePlugin', plugin: window.SpinePlugin, mapping: 'spine' }]
});
First, loading it in global will get game undefined, we can’t load it as global?
So I add that in scene list as in the reference, which (I am not sure if I do it right)
Here is where I refer to https://photonstorm.github.io/phaser3-docs/SpinePlugin.html
Did I load the plugin incorrectly?
Thanks!