Jump to content

Creature Dragon example is not working.


notalentgeek
 Share

Recommended Posts

The main.html file.

<!doctype html>
<html>
<head>
  <meta charset="utf-8" />
  <link href="{{ root }}/app.css" rel="stylesheet" type="text/css">
</head>
<body>
  <div class="flex-basic flex-row">
    <div class="flex-1"></div>
    <div class="flex-basic flex-column">
        <div class="flex-1"></div>
        <div id="phaser"></div>
        <div class="flex-1"></div>
    </div>
    <div class="flex-1"></div>
  </div>
  <script src="{{ node_modules_root }}/node_modules/phaser-ce/build/phaser.js"></script>
  <script src="{{ node_modules_root }}/node_modules/phaser-ce/build/custom/creature.js"></script>
  <script src="{{ node_modules_root }}/node_modules/phaser-ce/build/custom/p2.js"></script>
  <script src="{{ node_modules_root }}/node_modules/phaser-ce/build/custom/phaser-arcade-physics.js"></script>
  <script src="{{ node_modules_root }}/node_modules/phaser-ce/build/custom/phaser-creature.js"></script>
  <script src="{{ node_modules_root }}/node_modules/phaser-ce/build/custom/phaser-minimum.js"></script>
  <script src="{{ node_modules_root }}/node_modules/phaser-ce/build/custom/phaser-no-physics.js"></script>
  <script src="{{ node_modules_root }}/node_modules/phaser-ce/build/custom/phaser-split.js"></script>
  <script src="{{ node_modules_root }}/node_modules/phaser-ce/build/custom/pixi.js"></script>
  <script src="{{ root }}/bunch_of_functions.js"></script>
  <script src="{{ root }}/decorators.js"></script>
  <script src="./app.js"></script>
</body>
</html>

The app.js.

var game = new Phaser.Game(800, 600, Phaser.WEBGL, 'phaser-example', { preload: preload, create: create });

function preload() {

    game.load.image('sky', 'assets/background.png');
    game.load.image('dragonTexture', 'assets/dragon_character_texture.png');
    game.load.json('dragonMesh', 'assets/dragon_character_mesh.json');

}

var dragon = null;

function create() {

    game.add.image(0, 0, 'sky');

    dragon = game.add.creature(450, 350, 'dragonTexture', 'dragonMesh');

    dragon.scale.set(25.0);
    
    dragon.play(true); //  true = loop

}

Error:

pixi.js:76 Uncaught TypeError: PIXI.Point is not a constructor
    at Phaser.Stage.PIXI.DisplayObject (pixi.js:76)
    at Phaser.Stage.PIXI.DisplayObjectContainer (pixi.js:904)
    at new Phaser.Stage (phaser-split.js:9193)
    at Phaser.Game.boot (phaser-split.js:13780)
    at Phaser.Device._readyCheck (phaser-split.js:40872)

 

Link to comment
Share on other sites

Solved. From the most recent Phaser version, I need to import these .js files.

<script src="{{ node_modules_root }}/node_modules/phaser-ce/build/phaser.js"></script>
<script src="{{ node_modules_root }}/node_modules/phaser-ce/build/custom/creature.js"></script>
<script src="{{ node_modules_root }}/node_modules/phaser-ce/build/custom/p2.js"></script>
<script src="{{ node_modules_root }}/node_modules/phaser-ce/build/custom/phaser-arcade-physics.js"></script>
<script src="{{ node_modules_root }}/node_modules/phaser-ce/build/custom/phaser-creature.js"></script>
<script src="{{ node_modules_root }}/node_modules/phaser-ce/src/animation/creature/CreatureMeshBone.js"></script>

Hence, I think the documentation here: https://photonstorm.github.io/phaser-ce/Phaser.Creature.html is not valid anymore. It says that I need to compile my own version of Phaser with `Creature` included. Whereas `Creature` is now implemented by default.

Link to comment
Share on other sites

 Share

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...