wog Posted December 11, 2014 Share Posted December 11, 2014 I want to make polygon but have problem Uncaught TypeError: Cannot read property '0' of undefined this.points = this.groundGenerator(); this.poly = new Phaser.Polygon(this.points);this.graphics = this.game.add.graphics(0, 0); this.graphics.beginFill(0xFF33ff);this.graphics.drawPolygon(this.poly.points); this.graphics.endFill(); groundGenerator: function (){ var points = []; for(var x=this.getRandomInt(50, 150); x<1024; x+=this.getRandomInt(10, 100)) { points.push(new Phaser.Point(x, this.getRandomInt(0, -150) + 10)); } return points; } Thanks Link to comment Share on other sites More sharing options...
wog Posted December 11, 2014 Author Share Posted December 11, 2014 That solved. Just updated Phaser from 2.0.1 to 2.2.1 Link to comment Share on other sites More sharing options...
Recommended Posts