Search the Community
Showing results for tags 'constructor'.
-
Hello We have signed a big distribution for mobile contents market we need to make more games as possible every month, we offer revenue sharing for every game done. For more info just contact us our company www.bitbuu.com For the list of our networks just message us
-
- html5
- sharing revenue
-
(and 6 more)
Tagged with:
-
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)
- 6 replies
-
- constructor
- error
-
(and 2 more)
Tagged with:
-
Hello, I have been trying to use the .RayHelper constructor, but I keep getting an error saying that the RayHelper is not a constructor. I suspect that I am missing files. The ones that I have in my index.html are: - babylon.custom.js - babylon.objFileLoader.js - babylon.objFileLoader.min.js - hand.minified-1.2.js - Oimo.js How can I fix this error?
-
Hello, I have been trying to use the .RayHelper constructor, but I keep getting an error saying that the RayHelper is not a constructor. I suspect that I am missing files. The ones that I have in my index.html are: - babylon.custom.js - babylon.objFileLoader.js - babylon.objFileLoader.min.js - hand.minified-1.2.js - Oimo.js How can I fix this error?
-
Hello guys I have recently started doing my projects in ES6 and I am wondering the following. //Player.js class Player extends Phaser.Image { constructor(game, x, y, sheet, key) { super(game, x, y, sheet, key); } } export default Player; //GameState.js import Player from 'views/Player'; class GameState extends Phaser.State { create() { this.player = new Player(); // Cannot see required parameters //If I call it like that this.player = Player.constructor() // I can see them - obviously } } export default GameState; Should I just initialize the new Player and then just call the constructor so I can actually create what I need?
- 2 replies
-
- constructor
- params
-
(and 3 more)
Tagged with:
-
I'm working on a Phaser game but I'm running into some sort of scoping issue and I don't know how to solve it (also posted on stackoverflow btw) When the player wins a ResultPanel appears with the score and some buttons. The player can press the buttons to go to the next level or reset etc. The code to handle back/reset/next is in prototype functions, but those aren't yet defined when the constructor is called(?). At is it now, the function doBtnBack is never called when I press the button. What am I doing wrong? What's the right way to do this? // level complete panel constructor ResultPanel = function(game, stars) { this.game = game; // display how many yellow stars var star1 = stars > 0 ? 'star_yellow' : 'star_grey'; var star2 = stars > 1 ? 'star_yellow' : 'star_grey'; var star3 = stars > 2 ? 'star_yellow' : 'star_grey'; // add text and stars this._panelCaption = this.game.add.bitmapText(144, 12, 'bigrigsfont', 'you are winner!', 48); this._panelStar1 = this.game.add.sprite(300-160, 144, 'buttonicon', star1); this._panelStar2 = this.game.add.sprite(300, 144, 'buttonicon', star2); this._panelStar3 = this.game.add.sprite(300+160, 144, 'buttonicon', star3); // add button icons // NOTE: below code runs but something is wrong because // this.doBtnBack this.doBtnReset etc. is undefined this.btnBack = this.game.add.button(300-100, 300, 'buttonicon', this.doBtnBack, this, 'back_grey', 'back_hl'); this.btnReset = this.game.add.button(300, 300, 'buttonicon', this.doBtnReset, this, 'reset_grey', 'reset_hl'); this.btnNext = this.game.add.button(300+100, 300, 'buttonicon', this.doBtnNext, this, 'next_grey', 'next_hl'); }; ResultPanel.prototype.doBtnBack = function() { console.log('Panel button BACK pressed') // never reaches here }; ResultPanel.prototype.doBtnReset = function() { console.log('Panel button RESET pressed'); }; ResultPanel.prototype.doBtnNext = function() { console.log('Panel button NEXT pressed'); }; I also tried this, but that gives an error Uncaught TypeError: this.doBtnBack is not a function this.btnBack = this.game.add.button(300-100, 300, 'buttonicon', function(){this.doBtnBack();}, this, 4, 0, 8);
- 8 replies
-
- javascript
- prototype
-
(and 1 more)
Tagged with:
-
So each player object has a different playername.text_x number. The correct one! But only one is rendered! : ( Why? The constructor is below! var player = function () { var health = new PIXI.Graphics(); health.beginFill(0x00FF00); health.drawRect(0, drawAtY-50, 100/2.2, 6); health.endFill() //console.log("MAN STAGE "+MAIN.stage); MAIN.stage.addChild(health); var text_x; this.drawText = function(){ text_x = Math.abs(768/2) - localPlayer.localX() + drawAtX; this.text_x = text_x; health_shadow.position.x = text_x-25; health_shadow.position.y = drawAtY-100;}