Jump to content

What is "no constructor" error? Details are inside.


notalentgeek
 Share

Recommended Posts

I am currently learning Phaser by doing examples. Got into the dragon creature example, I need to import additional add-ons for Phaser.

I tried to import these JavaScript files.

<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>

These files are irrelevant for the dragon example. But, interesting error happened, `... is not a constructor`. For example `pixi.js:76 Uncaught TypeError: PIXI.Point is not a constructor`. The error happened when I imported the JavaScript file, even without any other JavaScript codes written. Why is that so? Can some explain what this error meant to me? And why the error happens by importing the JavaScript files?

Example of the error.

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

15 hours ago, samme said:

For Phaser/Creature, you should use either a custom build or these scripts, in order:

  1. creature.js
  2. p2.js
  3. pixi.js
  4. phaser-creature.js

Yea, I just figure it out myself. But this does not explain why `Uncaught TypeError: PIXI.Point is not a constructor` error happened. Neither, there is no information in the documentation.

Is there any JavaScript file that I should never import to the HTML file?

Link to comment
Share on other sites

 Share

  • Recently Browsing   0 members

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