mirror of
https://github.com/EsotericSoftware/spine-runtimes.git
synced 2026-02-04 22:34:53 +08:00
[phaser] Improve TypeScript example.
This commit is contained in:
parent
43caf7563b
commit
bf3f70379f
@ -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" }
|
||||
|
||||
@ -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" }
|
||||
]
|
||||
}
|
||||
};
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user