com.haxepunk.masks.Polygon

type
class
extends
Hitbox

Static Variables

Static Methods

createFromArray(points : Array<Float>) : Polygon

parameters
points
Creates a polygon from an array were even numbers are x and odd are y

createPolygon(?sides : Int, ?radius : Float, ?angle : Float) : Polygon

parameters
sides The number of sides in the polygon
radius The distance that the corners are at
angle How much the polygon is rotated
returns
The polygon
Creates a polygon with even sides

Constructor

new(points : Array<nme.geom.Point>, ?origin : nme.geom.Point)
parameters
points an array of coordinates that define the polygon (must have at least 3)
origin origin point of the polygon
Constructor.

Instance Variables hide inherited show inherited

angle(getAngle,setAngle) : Float

Angle in degress that the polygon is rotated.

height(getHeight,setHeight) : Int

Height.
The parent Masklist of the mask.

origin : nme.geom.Point

The polygon rotates around this point when the angle is set.

parent : Entity

inherited from com.haxepunk.Mask
The parent Entity of this mask.

points(getPoints,setPoints) : Array<nme.geom.Point>

The points representing the polygon. If you need to set a point yourself instead of passing in a new Array you need to call update() to makes sure the axes update as well.

width(getWidth,setWidth) : Int

Width.

x(getX,setX) : Int

X offset.

y(getY,setY) : Int

Y offset.

Instance Methods hide inherited show inherited

collide(mask : Mask) : Bool

inherited from com.haxepunk.Mask
parameters
mask The other Mask to check against.
returns
If the Masks overlap.
Checks for collision with another Mask.

collideCircle(circle : Circle) : Bool

collideGrid(grid : Grid) : Bool

parameters
grid
returns
May be very slow, mainly added for completeness sake Checks for collisions along the edges of the polygon

collidePolygon(other : Polygon) : Bool

debugDraw(graphics : nme.display.Graphics, scaleX : Float, scaleY : Float) : Void

inherited from com.haxepunk.Mask
Override this

update() : Void

Updates the parent's bounds for this mask.

inline updateAxes() : Void