Class: Polygon

Phaser. Polygon

The polygon represents a list of orderded points in space

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

Properties:
Name Type Description
points array.<Phaser.Point> | array.<number>

The array of Points.

Source:

type

Properties:
Name Type Description
type number

The base object type.

Source:

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
Phaser Copyright © 2012-2014 Photon Storm Ltd.
Documentation generated by JSDoc 3.3.0-dev on Fri Apr 11 2014 13:25:18 GMT+0100 (BST) using the DocStrap template.