notalentgeek Posted October 8, 2017 Share Posted October 8, 2017 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 More sharing options...
notalentgeek Posted October 9, 2017 Author Share Posted October 9, 2017 Up please... someone knows about this issue? Link to comment Share on other sites More sharing options...
Milton Posted October 9, 2017 Share Posted October 9, 2017 My guess is you either have a corrupt (incomplete) file, or something is redefined. Hard to tell... Link to comment Share on other sites More sharing options...
notalentgeek Posted October 9, 2017 Author Share Posted October 9, 2017 Finally, a respond. I have downloaded twice the library from `npm` the error still persists. Link to comment Share on other sites More sharing options...
Milton Posted October 9, 2017 Share Posted October 9, 2017 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. Link to comment Share on other sites More sharing options...
samme Posted October 9, 2017 Share Posted October 9, 2017 For Phaser/Creature, you should use either a custom build or these scripts, in order: creature.js p2.js pixi.js phaser-creature.js Link to comment Share on other sites More sharing options...
notalentgeek Posted October 10, 2017 Author Share Posted October 10, 2017 15 hours ago, samme said: For Phaser/Creature, you should use either a custom build or these scripts, in order: creature.js p2.js pixi.js 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 More sharing options...
Recommended Posts