Polygon#setTo()

setTo(points) → {Phaser.Polygon}

Sets this Polygon to the given points.

The points can be set from a variety of formats:

  • An array of Point objects: [new Phaser.Point(x1, y1), ...]
  • An array of objects with public x/y properties: [obj1, obj2, ...]
  • An array of paired numbers that represent point coordinates: [x1,y1, x2,y2, ...]
  • An array of arrays with two elements representing x/y coordinates: [[x1, y1], [x2, y2], ...]
  • As separate Point arguments: setTo(new Phaser.Point(x1, y1), ...)
  • As separate objects with public x/y properties arguments: setTo(obj1, obj2, ...)
  • As separate arguments representing point coordinates: setTo(x1,y1, x2,y2, ...)

setTo may also be called without any arguments to remove all points.

Parameters
Name Type Description
points Array.<Phaser.Point> | Array.<number> | Phaser.Point | number

The points to set.

Returns

This Polygon object

Source code: geom/Polygon.js (Line 186)
doc_phaser
2017-02-14 11:06:34
Comments
Leave a Comment

Please login to continue.