Sign in to follow this  
notalentgeek

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

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)

 

Share this post


Link to post
Share on other sites

Ok. I don't use either Phaser or Pixi, but I assume including Pixi f*cks up Phaser?

I know Phaser uses Pixi for renderering. You're probably not supposed to include it yourself.
Try to ping Samme or Rich.

Share this post


Link to post
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?

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
Sign in to follow this  

  • Recently Browsing   0 members

    No registered users viewing this page.