Phaser Creature 示例:Phaser.Creature 不是构造函数

Phaser Creature Example: Phaser.Creature is not a constructor

我真的很难让 dragon example 使用 Creature 制作的动画正常工作。

我总是遇到这个错误:

phaser28.js:47283 - Uncaught TypeError: Phaser.Creature is not a constructor

有问题的行是这些:

 creature: function (x, y, key, mesh, group) {

    if (group === undefined) { group = this.world; }

    var obj = new Phaser.Creature(this.game, x, y, key, mesh);

    group.add(obj);

    return obj;

},

我正在使用完整的移相器 2.8.0。应该包含所有模块的构建。我尝试从生物运行时另外加载各种其他 js 文件,但就是无法正常工作。

如有任何帮助,我们将不胜感激!

干杯

我遇到了类似这样的问题:http://www.html5gamedevs.com/topic/28612-ccreature-is-not-a-constructor/

尝试将这些模块添加到您的项目 (v2.8.0):

将它们导入您的索引:

<head>
<title>Phaser Test</title>
<script src="phaser.js" type="text/javascript"></script> <!--Framework-->
<script src="creature.js" type="text/javascript"></script>
<script src="phaser-creature.js" type="text/javascript"></script>
<script src="game.js" type="text/javascript"></script> <!--Code game-->
</head>