123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960 |
- <!DOCTYPE html>
- <html lang="en">
- <head>
- <meta charset="UTF-8" />
- <meta http-equiv="X-UA-Compatible" content="IE=edge" />
- <meta name="viewport" content="width=device-width, initial-scale=1.0" />
- <script src="//cdn.jsdelivr.net/npm/[email protected]/dist/phaser.js"></script>
- <script src="../dist/iife/spine-phaser-v3.js"></script>
- <link rel="stylesheet" href="../../index.css" />
- <title>Spine Phaser Example</title>
- </head>
- <body class="p-4 flex flex-col items-center">
- <h1>Add existing object</h1>
- </body>
- <script>
- class BasicExample 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(
- 200,
- 500,
- "spineboy-data",
- "spineboy-atlas"
- );
- const spineboy2 = this.add.existing(
- new spine.SpineGameObject(
- this,
- this.spine,
- 500,
- 500,
- "spineboy-data",
- "spineboy-atlas"
- )
- );
- }
- }
- new Phaser.Game({
- type: Phaser.AUTO,
- width: 800,
- height: 600,
- type: Phaser.WEBGL,
- scene: [BasicExample],
- plugins: {
- scene: [
- {
- key: "spine.SpinePlugin",
- plugin: spine.SpinePlugin,
- mapping: "spine",
- },
- ],
- },
- });
- </script>
- </html>
|