mirror of
https://github.com/EsotericSoftware/spine-runtimes.git
synced 2026-03-26 22:49:01 +08:00
[phaser] Improve TypeScript example.
This commit is contained in:
parent
43caf7563b
commit
bf3f70379f
@ -14,7 +14,7 @@
|
|||||||
<h1>Basic example</h1>
|
<h1>Basic example</h1>
|
||||||
</body>
|
</body>
|
||||||
<script>
|
<script>
|
||||||
class BasicScene extends Phaser.Scene {
|
class BasicExample extends Phaser.Scene {
|
||||||
preload() {
|
preload() {
|
||||||
this.load.spineBinary("spineboy-data", "assets/spineboy-pro.skel");
|
this.load.spineBinary("spineboy-data", "assets/spineboy-pro.skel");
|
||||||
this.load.spineAtlas("spineboy-atlas", "assets/spineboy-pma.atlas");
|
this.load.spineAtlas("spineboy-atlas", "assets/spineboy-pma.atlas");
|
||||||
@ -37,7 +37,7 @@
|
|||||||
width: 800,
|
width: 800,
|
||||||
height: 600,
|
height: 600,
|
||||||
type: Phaser.WEBGL,
|
type: Phaser.WEBGL,
|
||||||
scene: [BasicScene],
|
scene: [BasicExample],
|
||||||
plugins: {
|
plugins: {
|
||||||
scene: [
|
scene: [
|
||||||
{ key: "spine.SpinePlugin", plugin: spine.SpinePlugin, mapping: "spine" }
|
{ key: "spine.SpinePlugin", plugin: spine.SpinePlugin, mapping: "spine" }
|
||||||
|
|||||||
@ -1,7 +1,7 @@
|
|||||||
import {Scene} from "phaser"
|
import * as Phaser from "phaser"
|
||||||
import {SpinePlugin} from "@esotericsoftware/spine-phaser"
|
import * as spine from "@esotericsoftware/spine-phaser"
|
||||||
|
|
||||||
class SpineDemo extends Scene {
|
class SpineDemo extends Phaser.Scene {
|
||||||
preload() {
|
preload() {
|
||||||
this.load.spineBinary("spineboy-data", "assets/spineboy-pro.skel");
|
this.load.spineBinary("spineboy-data", "assets/spineboy-pro.skel");
|
||||||
this.load.spineAtlas("spineboy-atlas", "assets/spineboy-pma.atlas");
|
this.load.spineAtlas("spineboy-atlas", "assets/spineboy-pma.atlas");
|
||||||
@ -9,7 +9,6 @@ class SpineDemo extends Scene {
|
|||||||
|
|
||||||
create() {
|
create() {
|
||||||
const spineboy = this.add.spine(400, 500, 'spineboy-data', "spineboy-atlas");
|
const spineboy = this.add.spine(400, 500, 'spineboy-data', "spineboy-atlas");
|
||||||
this.make
|
|
||||||
spineboy.scale = 0.5;
|
spineboy.scale = 0.5;
|
||||||
spineboy.animationState.setAnimation(0, "walk", true);
|
spineboy.animationState.setAnimation(0, "walk", true);
|
||||||
}
|
}
|
||||||
@ -22,7 +21,7 @@ const config = {
|
|||||||
scene: [SpineDemo],
|
scene: [SpineDemo],
|
||||||
plugins: {
|
plugins: {
|
||||||
scene: [
|
scene: [
|
||||||
{ key: "spine.SpinePlugin", plugin: SpinePlugin, mapping: "spine" }
|
{ key: "spine.SpinePlugin", plugin: spine.SpinePlugin, mapping: "spine" }
|
||||||
]
|
]
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user