var config = {
type: Phaser.AUTO,
width: 800,
height: 600,
scene: {
create: create
}
};
var game = new Phaser.Game(config);
function create() {
this.add.rectangle(100, 100, 100, 100, 0xee0000);
var graphics = this.add.graphics();
var polygon = new Phaser.Geom.Polygon([
200, 150,
400, 300,
600, 150,
750, 300,
600, 450,
200, 450,
50, 300
]);
graphics.fillStyle(0x00aa00);
graphics.fillPoints(polygon.points, true);
}
This will draw a rectangle and a polygon. But when I remove the code for the polygon, leaving just the first line in the create function, the rectangle also won’t be drawn anymore. Why is that? What part of the polygon/graphics part is necessary for the rectangle to be drawn?