search API (or start typing anywhere)
Polygon
differ.shapes.Polygon
A polygonal collision shape
class
extends differ.shapes.Shape
Members
Properties
transformedVertices
transformedVertices : Array<differ.math.Vector>
The transformed (rotated/scale) vertices cache vertices
vertices : Array<differ.math.Vector>
The vertices of this shape
Methods
createstatic
create(x:Float, y:Float, sides:Int, radius:Float) : differ.shapes.Polygon
Helper to create an Ngon at x,y with given number of sides, and radius. A default radius of 100 if unspecified. Returns a ready made
Polygon
collision Shape
destroy
destroy() : Void
Destroy this polygon and clean up. new
new(x:Float, y:Float, vertices:Array<differ.math.Vector>) : Void
Create a new polygon with a given set of vertices at position x,y. rectanglestatic
rectangle(x:Float, y:Float, width:Float, height:Float, centered:Bool) : differ.shapes.Polygon
Helper generate a rectangle at x,y with a given width/height and centered state. Centered by default. Returns a ready made
Polygon
collision Shape
squarestatic
square(x:Float, y:Float, width:Float, centered:Bool) : differ.shapes.Polygon
Helper generate a square at x,y with a given width/height with given centered state. Centered by default. Returns a ready made
Polygon
collision Shape
test
test(shape:differ.shapes.Shape, into:differ.data.ShapeCollision) : differ.data.ShapeCollision
Test for a collision with a shape. testCircle
testCircle(circle:differ.shapes.Circle, into:differ.data.ShapeCollision, flip:Bool) : differ.data.ShapeCollision
Test for a collision with a circle. testPolygon
testPolygon(polygon:differ.shapes.Polygon, into:differ.data.ShapeCollision, flip:Bool) : differ.data.ShapeCollision
Test for a collision with a polygon. testRay
testRay(ray:differ.shapes.Ray, into:differ.data.RayCollision) : differ.data.RayCollision
Test for a collision with a ray. trianglestatic
triangle(x:Float, y:Float, radius:Float) : differ.shapes.Polygon
Helper generate a triangle at x,y with a given radius. Returns a ready made
Polygon
collision Shape