Jump to content

Polygon problem


wog
 Share

Recommended Posts

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

 Share

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...