Polygons can be made with arrays of points like so.
Code: Select all
local points = {
{x=20, y=20},
{x=40, y=20},
{x=30, y=30},
{x=30, y=40},
{x=20, y=30},
}
myPolygon = OL.create.basic(points) --now your polygon is stored in that table
Code: Select all
OL.angle.rotate(myPolygon, 5) --rotates polygon by 5 degrees
OL.position.move(myPolygon, 10, 10) --moves the polygon by 10x and 10y
OL.scale.change(myPolygon, 2) --makes the polygon twice as big
Code: Select all
OL.collision.basic(myPolygon, anotherPolygon) --returns true if touching and false if not.
List of functions:
OL.create.basic
OL.create.advanced
OL.collision.basic
OL.collision.advanced
OL.collision.setCustomTags
OL.collision.setTag
OL.position.set
OL.position.move
OL.position.movePoint
OL.angle.set
OL.angle.rotate
OL.angle.rotatePoint
OL.scale.set
OL.scale.change
OL.scale.changePoint
OL.draw.basic
OL.draw.advanced
OL.draw.setColorPalet
OL.draw.changeColor
Feel free to make it better and release it as your own. I don't really care what you do with this, just credit me in some small form. If anyone makes anything with this, I would love to see it.