Search the Community
Showing results for tags 'add to group'.
-
Hi All, I am using Phaser 2.5.0 I am trying to add a graphics (polygon) to a group. Please see the below code for your reference. I am getting below two javascript errors. Uncaught TypeError: child.setStageReference is not a function phaser.js:14661 Uncaught TypeError: this.children.preUpdate is not a function phaser.js:33643 The error is comming from the last line this.wrongLocation.add(poly); Can some one please let me know what could be the reason for the error. Please note that i can add a sprite to a group using similar code without any problem. Thanks for your help this.wrongLocation = this.add.group(); this.wrongLocation.enableBody = true; x = 360; y = 0; var poly = new Phaser.Polygon([ new Phaser.Point(x+64, y), new Phaser.Point(x+131, y+33), new Phaser.Point(x+66, y+64), new Phaser.Point(x, y+32) ]); graphics = this.gathis.add.graphics(0, 0); graphics.beginFill(0xFF33ff); graphics.drawPolygon(poly.points); graphics.endFill(); this.wrongLocation.add(poly); Also I try to add the graphics to the group as below code me.wrongLocation.add(graphics); I can't see the error but the overlap between a sprite and this graphic is not working with the below code me.game.physics.arcade.overlap(me.taxiNE, me.wrongLocation, me.hitTheRoad); Any help will highly appreciated
- 2 replies
-
- poligon
- add to group
-
(and 1 more)
Tagged with: