timelinefx:timelinefx.CreatePolygon
Create a tlPolygon
Returns New tlPolygon, or Null if verts[] contained the wrong amount.
Create a new tlPolygon at the given coordinates with the given array of vertices. The coordinates will represent the center of the polygon which is
automatically calculated. The array must contain more then 5 values (2 per vertex) and be an even number or null will be returned. The coordinates of
the vertices in the array are arranged like so: [x,y,x,y,x,y .. etc]. Use layer to specify a particular layer
to place the box on so that you can more easily organise your collisions. You use 0, 1, 2..and so on up to 31
to place the boundary on all layers.
| Note: |
|:-----------|
| Polygon must be convex (no internal angles > 180deg)
@example
Local box:=CreatePolygon(100, 100, new Float[](- 10.0, -10.0, -15.0, 0.0, -10.0, 10.0, 10.0, 10.0, 15.0, 0.0, 10.0, -10.0), 0)
@end
| Parameters |
|
x |
Top left y coordinate |
y |
Top Left x coordinate |
verts |
Array of vertices that descibe the Polygon |
layer |
The layer that the box is on, used for quadtrees |
data |
any Object associated with the box |