new Polygon(points)
Creates a new Polygon. You have to provide a list of points.
This can be an array of Points that form the polygon, a flat array of numbers that will be interpreted as [x,y, x,y, ...],
or the arguments passed can be all the points of the polygon e.g. new Phaser.Polygon(new Phaser.Point(), new Phaser.Point(), ...)
, or the
arguments passed can be flat x,y values e.g. new Phaser.Polygon(x,y, x,y, x,y, ...)
where x
and y
are numbers.
Parameters:
Name | Type | Description |
---|---|---|
points |
Array.<Phaser.Point> | Array.<number> | The array of Points. |
- Source:
Members
-
points
-
- Source:
Properties:
Name Type Description points
array.<Phaser.Point> | array.<number> The array of Points.
-
type
-
- Source:
Properties:
Name Type Description type
number The base object type.
Methods
-
clone() → {Phaser.Polygon}
-
Creates a clone of this polygon.
- Source:
Returns:
A copy of the polygon.
- Type
- Phaser.Polygon
-
contains(x, y) → {boolean}
-
Checks whether the x and y coordinates are contained within this polygon.
Parameters:
Name Type Description x
number The X value of the coordinate to test.
y
number The Y value of the coordinate to test.
- Source:
Returns:
True if the coordinates are within this polygon, otherwise false.
- Type
- boolean