I have the .js files for both Canvas and webgl (runtimes?). They are both loaded in my index.html The console keeps telling me this.add.spine() is not a function, so clearly I am missing something.
I dug through the examples and read through the stuff on here, and cannot figure this out. Spine is awesome and I can use it, but putting the stuff into Phaser isn’t happening. The readme Spine came with said to add export{spine} at the end of the runtime file, which I did, but then I don’t know where to add
import{spine} from ‘/spine-webgl.js’
No matter where I put it, I still get “…is not a function”
Here is my index.html:
<!doctype html>
<head>
<meta charset="utf-8"/>
<title>Apple Picker: Collector's Edition</title>
<div id="canvas"> <style>
canvas {
width: 60%;
height: 60%;
padding: 20px;
background: black;
}
</style></div>
</head>
<body>
<style>
canvas{
display: block;
margin: 0;
position:absolute;
top:50%;
left:50%;
transform: translate(-50%,-50%);
}
</style>
<script src="phaser.js"></script>
<script src="spine-canvas.js"></script>
<script src="spine-webgl.js"></script>
<script src='preload.js'></script>
<script src='title.js'></script>
<script src="game.js"></script>
<script src="gameover.js"></script>
<script src="main.js"></script>
</body>
And here is my configuration (main.js):
// set game configuration
let config = {
type: Phaser.AUTO,
width: 900,
height: 700,
scene: [preloadScene, titleScene, gameScene,gameoverScene],
pixelArt: false,
};
//create new game and send configuration
let game = new Phaser.Game(config)