[phaser] Improve TypeScript example.

This commit is contained in:
Mario Zechner 2023-04-26 11:16:13 +02:00
parent 43caf7563b
commit bf3f70379f
2 changed files with 7 additions and 8 deletions

View File

@ -14,7 +14,7 @@
<h1>Basic example</h1>
</body>
<script>
class BasicScene extends Phaser.Scene {
class BasicExample extends Phaser.Scene {
preload() {
this.load.spineBinary("spineboy-data", "assets/spineboy-pro.skel");
this.load.spineAtlas("spineboy-atlas", "assets/spineboy-pma.atlas");
@ -37,7 +37,7 @@
width: 800,
height: 600,
type: Phaser.WEBGL,
scene: [BasicScene],
scene: [BasicExample],
plugins: {
scene: [
{ key: "spine.SpinePlugin", plugin: spine.SpinePlugin, mapping: "spine" }

View File

@ -1,15 +1,14 @@
import {Scene} from "phaser"
import {SpinePlugin} from "@esotericsoftware/spine-phaser"
import * as Phaser from "phaser"
import * as spine from "@esotericsoftware/spine-phaser"
class SpineDemo extends Scene {
class SpineDemo extends Phaser.Scene {
preload() {
this.load.spineBinary("spineboy-data", "assets/spineboy-pro.skel");
this.load.spineAtlas("spineboy-atlas", "assets/spineboy-pma.atlas");
}
create() {
const spineboy = this.add.spine(400, 500, 'spineboy-data', "spineboy-atlas");
this.make
const spineboy = this.add.spine(400, 500, 'spineboy-data', "spineboy-atlas");
spineboy.scale = 0.5;
spineboy.animationState.setAnimation(0, "walk", true);
}
@ -22,7 +21,7 @@ const config = {
scene: [SpineDemo],
plugins: {
scene: [
{ key: "spine.SpinePlugin", plugin: SpinePlugin, mapping: "spine" }
{ key: "spine.SpinePlugin", plugin: spine.SpinePlugin, mapping: "spine" }
]
}
};