I do get this error when i try to spine my assets:
console.log(this.load);
this.load.spineBinary('enemy-skel', '/mini-apps/tip-shot/spine/enemy.skel');
this.load.spineAtlas(
'enemy-atlas',
'/mini-apps/tip-shot/spine/enemy.atlas',
);
and indeed when i log this.load there are no spineBinary
or spineAtlas
I'm using nextjs 14 and i do have following config:
import * as Phaser from 'phaser';
import { Game } from 'phaser';
// import * as spine from '@esotericsoftware/spine-phaser';
import 'phaser/plugins/spine/dist/SpinePlugin';
console.log(window.SpinePlugin);
this.game = new Game({
type: Phaser.WEBGL,
canvas: getCanvas(),
width: GAME_WIDTH, // smart phone vertical
height: GAME_HEIGHT,
backgroundColor: MyColor.blackStr,
physics: {
default: 'matter',
matter: {
debug: true, // TODO (johnedvard) remove debug if production
gravity: { x: 0, y: 0 },
autoUpdate: false,
},
},
input: {
gamepad: true,
},
plugins: {
scene: [
{ key: 'SpinePlugin', plugin: window.SpinePlugin, mapping: 'spine' },
{
key: 'MatterGravityFixPlugin',
plugin: MatterGravityFixPlugin,
mapping: 'matterGravityFix',
start: true,
},
{
key: 'MatterFixedStepPlugin',
plugin: MatterFixedStepPlugin,
start: true,
},
],
},
scale: {
mode: Phaser.Scale.HEIGHT_CONTROLS_WIDTH,
autoCenter: Phaser.Scale.CENTER_BOTH,
},
});
then i load the game like so
'use client';
import { useEffect } from 'react';
export default function GameCanvas() {
useEffect(() => {
if (!window) {
return;
}
const init = async () => {
const MyGame = (
await import('@/lib/utils/mini-apps/tip-shot/objects/Game')
).MyGame;
new MyGame();
postMessage({ payload: 'removeLoading' }, '*');
};
init();
}, []);
return (
<div className="h-full p-0 m-0 overflow-hidden bg-[#131313]">
<canvas id="my-game"></canvas>
</div>
);
}
but then facing this issue: this.load.spineBinary is not a function
any idea why this functionality is missing from load
object and what to do to be able to load the assets