Class tlBox |
Description: | Collision box class |
Table of contents: | Methods:
- BoundingBoxOverlap ( Method BoundingBoxOverlap:Int(rect:tlBox, velocitycheck:Int = False) )
- BoxCollide ( Method BoxCollide:tlCollisionResult(box:tlBox) )
- CircleCollide ( Method CircleCollide:tlCollisionResult(circle:tlCircle) )
- CircleOverlap ( Method CircleOverlap:Int(circle:tlCircle) )
- CollisionLayer ( Method CollisionLayer:Int() Property )
- CollisionLayer ( Method CollisionLayer(Layer:Int) Property )
- Data ( Method Data(d:Object) Property )
- Data ( Method Data:Object() Property )
- Draw ( Method Draw(offsetx:Float = 0, offsety:Float = 0, boundingbox:Int = False) )
- GetCollisionType ( Method GetCollisionType:Int() )
- GetShadowPolys ( Method GetShadowPolys:TList (Light:tlVector2, lType:Int = tlDIRECTIONAL_LIGHT, lengthfactor:Float = 1) )
- GetWorldX ( Method GetWorldX:Float() )
- GetWorldY ( Method GetWorldY:Float() )
- Height ( Method Height:Float() Property )
- LineCollide ( Method LineCollide:tlCollisionResult(line:tlLine) )
- Move ( Method Move(x:Float, y:Float) )
- PointInside ( Method PointInside:Int(x:Float, y:Float) )
- PolyCollide ( Method PolyCollide:tlCollisionResult(poly:tlPolygon) )
- PreventOverlap ( Method PreventOverlap(result:tlCollisionResult, push:Int = False) )
- RayCollide ( Method RayCollide:tlCollisionResult(px:Float, py:Float, dx:Float, dy:Float, maxdistance:Float = 0) )
- ReDimension ( Method ReDimension(x:Float, y:Float, w:Float, h:Float) )
- RectWithin ( Method RectWithin:Int(rect:tlBox) )
- Repel ( Method Repel(result:tlCollisionResult, push:Int = False, factor:Float = 0.1) )
- Separate ( Method Separate(result:tlCollisionResult, sourcefactor:Float = 0.1, targetfactor:Float = 0.1) )
- SetHandlePosition ( Method SetHandlePosition(x:Float, y:Float) )
- SetPosition ( Method SetPosition(x:Float, y:Float) )
- SetScale ( Method SetScale(x:Float, y:Float) )
- SetVelocity ( Method SetVelocity(velocity_x:Float, velocity_y:Float) )
- UpdatePosition ( Method UpdatePosition() )
- Width ( Method Width:Float() Property )
|
Method BoundingBoxOverlap:Int(rect:tlBox, velocitycheck:Int = False) | Description: | Compare this #tlBox with another to see if they overlap | Returns: | Int | Details: | Returns True if they do overlap Use this to find out if this #tlBox overlaps the #tlBox you pass to it. This is a very simple overlap to see if the bounding box overlaps only Set VelocityCheck to true if you want to see if they will overlap next frame based on their velocities.
|
|
Method BoxCollide:tlCollisionResult(box:tlBox) | Description: | Check for a collision with another #tlBox | Returns: | tlCollisionResult | Details: | Returns #tlCollisionResult type containing info about the collision Use this to check for a collision with another #tlBox that you pass to the method. You can then use the information stored in #tlCollisionResult to perform various things based on the result of the collision check.
|
|
Method CircleCollide:tlCollisionResult(circle:tlCircle) | Description: | Check for a collision with a #tlCircle | Returns: | tlCollisionResult | Details: | Returns #tlCollisionResult type containing info about the collision Use this to check for a collision with a #tlCircle that you pass to the method. You can then use the information stored in #tlCollisionResult to perform various things based on the result of the collision check.
|
|
Method CircleOverlap:Int(circle:tlCircle) | Description: | Compare this #tlBox with a #tlCircle | Returns: | Int | Details: | Returns True if they do overlap This will perfrom a simple bounding box to circle collision check on the #tlCircle you pass to it.
|
|
Method CollisionLayer:Int() Property | Description: | Get the collision layer that this boundary is on | Returns: | Int | Details: | Returns The Collision layer flag Every boundary can exist on a sepcific layer from 1-32 to make it easier to handle what objects you want to collide with each other.
|
|
Method CollisionLayer(Layer:Int) Property | Description: | Set the collision layer that this boundary is on | Returns: | Int | Details: | The layer a boundary is on can determine what other boundarys this one can collide with. You may not want some objects to be able to collide with each other, so you can arrange them of different layers. There are 32 layers, assigned to constants: tlLAYER_0, tlLAYER1, tlLAYER_2 and so on up to 32, so to assign a layer, simply pass the appropriate constant: MyBox.SetCollisionLayer(tlLAYER_1)
|
|
Method Data(d:Object) Property | Description: | Assign an object to the boundary | Returns: | Int | Details: | This can be handy to store extra custom info about the boundary.
|
|
Method Data:Object() Property | Description: | Get the data assigned to this boundary | Returns: | Object | Details: | Use this to retrieve the custom data you have assign to the boundary.
|
|
Method Draw(offsetx:Float = 0, offsety:Float = 0, boundingbox:Int = False) | Description: | Draw this tlBox | Returns: | Int | Details: | Use this if you need to draw the bounding box for debugging purposes
|
|
Method GetCollisionType:Int() | Description: | Get the collision type of the Box | Returns: | Int | Details: | Returns Either tlBOX_COLLISION, tlCIRCLE_COLLISION, tlLINE_COLLISION or tlPOLY_COLLISION the collision type can help you determine what type of collision you should be performing on objects calledback from quadtree queries.
|
|
Method GetShadowPolys:TList (Light:tlVector2, lType:Int = tlDIRECTIONAL_LIGHT, lengthfactor:Float = 1) | Description: | Get a poly represting the shadow of the box | Returns: | TList | Details: | Returns tList of tlPolygons representing each shadow cast by each line in the box This will take a light located at Light:tlVector2 and create a list of tlPolygons representing a shadow cast by each line in the box.
|
|
Method GetWorldX:Float() | Description: | Get the x world coordinate of the boundary | Returns: | Float | Details: | Returns Float with the current x coordinate You can use this to find out the current x coordinate of the boundary. This would be especially useful if you have just used #PreventOverlap and need to know the new position of the object to update your game object.
|
|
Method GetWorldY:Float() | Description: | Get the y world coordinate of the boundary | Returns: | Float | Details: | Returns Float with the current y coordinate You can use this to find out the current y coordinate of the boundary. This would be especially useful if you have just used #PreventOverlap and need to know the new position of the object to update your game object.
|
|
Method Height:Float() Property | Description: | Get the current height of the box | Returns: | Float | Details: | Returns The current height taking into account scale
|
|
Method LineCollide:tlCollisionResult(line:tlLine) | Description: | Check for a collision with a #tlLine | Returns: | tlCollisionResult | Details: | Returns #tlCollisionResult type containing info about the collision Use this to check for a collision with a #tlLine that you pass to the method. You can then use the information stored in #tlCollisionResult to perform various things based on the result of the collision check.
|
|
Method Move(x:Float, y:Float) | Description: | Move the bounding box by a given amount. | Returns: | Int | Details: | This sets the position of the top left corner of the bounding box by moving it by the x and y amount. If the box is within quadtree it will automatically update itself within it.
|
|
Method PointInside:Int(x:Float, y:Float) | Description: | Find out if a point is within the bounding box | Returns: | Int | Details: | Returns True if the point is within Use this to find out if a point at x,y falls with the bounding box of this #tlBox
|
|
Method PolyCollide:tlCollisionResult(poly:tlPolygon) | Description: | Check for a collision with a #tlPolygon | Returns: | tlCollisionResult | Details: | Returns #tlCollisionResult type containing info about the collision Use this to check for a collision with a #tlPolygon that you pass to the method. You can then use the information stored in #tlCollisionResult to perform various things based on the result of the collision check.
|
|
Method PreventOverlap(result:tlCollisionResult, push:Int = False) | Description: | Prevent the boundary from overlapping another based on the result of a collision. | Returns: | Int | Details: | When you check for a collision, the results of that collision are stored with a #tlCollisionResult. This can be passed to this method to prevent 2 boundaries from overlapping. If push is set to true, then the source boundary will push the target boundary along it's velocity vector.
|
|
Method RayCollide:tlCollisionResult(px:Float, py:Float, dx:Float, dy:Float, maxdistance:Float = 0) | Description: | See is a ray collides with this #tlbox | Returns: | tlCollisionResult | Details: | Returns #tlCollisionResult with the results of the collision You can use this to test for a collision with a ray. Pass the origin of the ray with px and py, and set the direction of the ray with dx and dy. dx and dy will be normalised and extended infinitely, if maxdistance equals 0 (default), otherwise set maxdistance to how ever far you want the ray to extend to. If the ray starts inside the box then result.rayorigininside will be set to true.
|
|
Method ReDimension(x:Float, y:Float, w:Float, h:Float) | Description: | Reset the dimensions of the box to a new width and height | Returns: | Int |
|
Method RectWithin:Int(rect:tlBox) | Description: | Find out if a #tlBox lies within this objects bounding box | Returns: | Int | Details: | Returns True if it is within If you need to know whether a #tlBox you pass to this method, lies entirely with this #tlBox (no overlapping) then you can use this method. #REMember, if you call this method from a poly, line or circle, it will only check against the bounding boxes.
|
|
Method Repel(result:tlCollisionResult, push:Int = False, factor:Float = 0.1) | Description: | Repel boundaries that overlap | Returns: | Int | Details: | Rather then simply preventing an overlap outright, this will ease a boundary away slowly until it no longer overlaps. This can be useful to separate groups of entities away from each other in a more smooth fashion. As with #PreventOverlap set push to true to push the other entity away.
|
|
Method Separate(result:tlCollisionResult, sourcefactor:Float = 0.1, targetfactor:Float = 0.1) | Description: | Separate boundaries that overlap | Returns: | Int | Details: | This is slightly different to #Repel in that both objects will be moved away from each other according to the 2 factors you pass to it. So you can either push them away from each other equally or you can weight one or the other.
|
|
Method SetHandlePosition(x:Float, y:Float) | Description: | Set the handle of the boundary | Returns: | Int | Details: | setting the handle let's you offset where the boundary exists in the world. By default the handle is located at the center of the boudary.
|
|
Method SetPosition(x:Float, y:Float) | Description: | Set the position of the bounding box. | Returns: | Int | Details: | This sets the position of the top left corner of the bounding box. If the box is within quadtree it will automatically update itself within it.
|
|
Method SetScale(x:Float, y:Float) | Description: | Set the scale of the Box | Returns: | Int | Details: | This sets scale of the Box.
|
|
Method SetVelocity(velocity_x:Float, velocity_y:Float) | Description: | Set the velocity of the boundary | Returns: | Int | Details: | It's import to set the velocity of the boundary so that collisions can be more accurately calculated. If you're attaching this to an entity in your game then you'll just need to match this to your entities velocity.
|
|
Method UpdatePosition() | Description: | Update the position of the boundary | Returns: | Int | Details: | You can use this method to update it's position according to its current velocity vector
|
|
Method Width:Float() Property | Description: | Get the current width of the box | Returns: | Float | Details: | Returns The current width taking into account scale
|
|
Class tlCircle Extends tlBox |
Description: | Collision circle class |
Table of contents: | Methods:
- BoundingBoxOverlap ( Method BoundingBoxOverlap:Int(rect:tlBox, velocitycheck:Int = False) )
- BoxCollide ( Method BoxCollide:tlCollisionResult(box:tlBox) )
- CircleCollide ( Method CircleCollide:tlCollisionResult(circle:tlCircle) )
- CircleOverlap ( Method CircleOverlap:Int(circle:tlCircle) )
- Draw ( Method Draw(offsetx:Float = 0, offsety:Float = 0, boundingbox:Int = False) )
- LineCollide ( Method LineCollide:tlCollisionResult(line:tlLine) )
- New ( Method New(x:Float, y:Float, radius:Float, layer:Int = tlLAYER_0, data:Object = Null) )
- PointInside ( Method PointInside:Int(x:Float, y:Float) )
- PolyCollide ( Method PolyCollide:tlCollisionResult(poly:tlPolygon) )
- Radius ( Method Radius:Float() Property )
- RayCollide ( Method RayCollide:tlCollisionResult(px:Float, py:Float, dx:Float, dy:Float, maxdistance:Float = 0) )
- SetCircle ( Method SetCircle(x:Float, y:Float, _radius:Float) )
|
Method BoundingBoxOverlap:Int(rect:tlBox, velocitycheck:Int = False) | Description: | Compare this #tlCircle with a #tlBox | Returns: | Int | Details: | Returns True if they do overlap This will perfrom a simple circle to bounding box overlap check on the #tlBox you pass to it.
|
|
Method BoxCollide:tlCollisionResult(box:tlBox) | Description: | Check for a collision with a #tlBox | Returns: | tlCollisionResult | Details: | Returns #tlCollisionResult type containing info about the collision Use this to check for a collision with a #tlBox that you pass to the method. You can then use the information stored in #tlCollisionResult to perform various things based on the result of the collision check.
|
|
Method CircleCollide:tlCollisionResult(circle:tlCircle) | Description: | Check for a collision with another #tlCircle | Returns: | tlCollisionResult | Details: | Returns #tlCollisionResult type containing info about the collision Use this to check for a collision with another #tlCircle that you pass to the method. You can then use the information stored in #tlCollisionResult to perform various things based on the result of the collision check.
|
|
Method CircleOverlap:Int(circle:tlCircle) | Description: | Compare this circle with another #tlCircle | Returns: | Int | Details: | Returns True if they do overlap This will perfrom a simple circle to circle collision check on the #tlCircle you pass to it.
|
|
Method Draw(offsetx:Float = 0, offsety:Float = 0, boundingbox:Int = False) | Description: | Draw this tlBox | Returns: | Int | Details: | Use this if you need to draw the bounding box for debugging purposes. Pass true of false to draw the bounding box as well.
|
|
Method LineCollide:tlCollisionResult(line:tlLine) | Description: | Check for a collision with a #tlLine | Returns: | tlCollisionResult | Details: | Returns #tlCollisionResult type containing info about the collision Use this to check for a collision with a #tlLine that you pass to the method. You can then use the information stored in #tlCollisionResult to perform various things based on the result of the collision check.
|
|
Method New(x:Float, y:Float, radius:Float, layer:Int = tlLAYER_0, data:Object = Null) | Description: | Create a #tlCircle | Details: | Returns New #tlCircle Create a new #tlCircle at the given coordinates with the given radius. The coordinates will represent where the center of the circle is located in the world. You can also assign some data to the boundary as handy way to store some extra info about the boundary.
|
|
Method PointInside:Int(x:Float, y:Float) | Description: | Find out if a point is within the circle | Returns: | Int | Details: | Returns True if the point is within Use this to find out if a point at x,y falls with the radius of this #tlCircle
|
|
Method PolyCollide:tlCollisionResult(poly:tlPolygon) | Description: | Check for a collision with a #tlPolygon | Returns: | tlCollisionResult | Details: | Returns #tlCollisionResult type containing info about the collision Use this to check for a collision with another #tlPolygon that you pass to the method. You can then use the information stored in #tlCollisionResult to perform various things based on the result of the collision check.
|
|
Method Radius:Float() Property | Description: | Get the current radius of the box | Returns: | Float | Details: | Returns The current radius taking into account scale
|
|
Method RayCollide:tlCollisionResult(px:Float, py:Float, dx:Float, dy:Float, maxdistance:Float = 0) | Description: | See is a ray collides with this #tlCircle | Returns: | tlCollisionResult | Details: | Returns #tlCollisionResult with the results of the collision You can use this to test for a collision with a ray. Pass the origin of the ray with px and py, and set the direction of the ray with dx and dy. dx and dy will be normalised and extended infinitely, if maxdistance equals 0 (default), otherwise set maxdistance to how ever far you want the ray to extend to. If the ray starts inside the poly then result.rayorigininside will be set to true.
|
|
Method SetCircle(x:Float, y:Float, _radius:Float) | Description: | Set the Box of the circle | Returns: | Int | Details: | this lets you change the size and location of the #tlCircle
|
|
Class tlCollisionResult |
Description: | Class for storing the results of a collision |
Table of contents: | Methods:
|
Method GetReboundVector:tlVector2(v:tlVector2, friction:Float = 0, bounce:Float = 1) | Description: | Get the rebound vector | Returns: | tlVector2 | Details: | Returns New #tlVector2 with the resulting rebound vector When an object collides with a surface you may want to know a resulting vector based on bounce and friction. So you can call this and pass the velocity vector of the incoming object, and the amount of bounce and friction to have, where a bounce value of 1 and a friction value of 0 will result in a perfect bounce.
|
|
Method Intersecting:Int() Property | Description: | Find out if the last collision check is intersecting | Returns: | Int | Details: | Returns true if there was an intersection
|
|
Method IsColliding:Int() Property | Description: | Find out if the last collision check found a collision | Returns: | Int | Details: | Returns true if there was a collision
|
|
Method RayDistance:Float() Property | Description: | Get the distance from the ray origin to the instersection point | Returns: | Float | Details: | Returns float value of distance the ray travelled, 0 if there was no intersection
|
|
Method RayIntersection:tlVector2() Property | Description: | Get the intersection point of the raycast | Returns: | tlVector2 | Details: | If a ray cast has been performed and the ray successfully connected, then this will return the point of intersection as a #tlVector2.
|
|
Method RayOriginInside:Int() Property | Description: | Find out if the last ray cast found that the ray originated inside the boundary | Returns: | Int | Details: | Returns true if the last ray check originated inside the boundary
|
|
Method RaySurfaceNormal:tlVector2() Property | Description: | Get the surface normal that the ray hits | Returns: | tlVector2 | Details: | If a ray cast has been performed and the ray successfully connected, then this will return the normal vector of the surface being hit.
|
|
Method SourceBoundary:tlBox() Property | Description: | Gets the Source boundary of a collision check | Returns: | tlBox | Details: | Returns #tlBox Or null if no collision occurred
|
|
Method TargetBoundary:tlBox() Property | Description: | Gets the Target boundary of a collision check | Returns: | tlBox | Details: | Returns #tlBox Or null if no collision occurred
|
|
Method TranslationVector:tlVector2() Property | Description: | Get the translation vector of the collision | Returns: | tlVector2 | Details: | If the collision check finds that either the objects are intersecting, or they will intersect, then the translation vector hold exactly how much they do or will overlap. This can then be used to move the 2 objects apart to prevent them overlapping. Handy if you have a wall that you don't want a player to move through. See #PreventOverlap to automate this process further.
|
|
Method WillIntersect:Int() Property | Description: | Find out if the last collision check is intersecting | Returns: | Int | Details: | Returns true if there will be an intersection knowing if there will be an intersection allows you to adjust the position of objects so that visually they will never overlap. To do this you can use the information stored in the translation vector, which is the vector describing how much the objects need to move so that they no longer overlap. See #GetTranslationVector
|
|
Class tlLine Extends tlPolygon |
Description: | Collision line class |
Table of contents: | Methods:
- BoxCollide ( Method BoxCollide:tlCollisionResult(Box:tlBox) )
- CircleCollide ( Method CircleCollide:tlCollisionResult(circle:tlCircle) )
- LineCollide ( Method LineCollide:tlCollisionResult(line:tlLine) )
- New ( Method New(x1:Float, y1:Float, x2:Float, y2:Float, layer:Int = tlLAYER_0, data:Object = Null) )
- PolyCollide ( Method PolyCollide:tlCollisionResult(poly:tlPolygon) )
- RayCollide ( Method RayCollide:tlCollisionResult(px:Float, py:Float, dx:Float, dy:Float, maxdistance:Float = 0) )
|
Method BoxCollide:tlCollisionResult(Box:tlBox) | Description: | Check for a collision with a #tlBox | Returns: | tlCollisionResult | Details: | Returns #tlCollisionResult type containing info about the collision Use this to check for a collision with a #tlBox that you pass to the method. You can then use the information stored in #tlCollisionResult to perform various things based on the result of the collision check.
|
|
Method CircleCollide:tlCollisionResult(circle:tlCircle) | Description: | Check for a collision with a #tlCircle | Returns: | tlCollisionResult | Details: | Returns #tlCollisionResult type containing info about the collision Use this to check for a collision with a #tlCircle that you pass to the method. You can then use the information stored in #tlCollisionResult to perform various things based on the result of the collision check.
|
|
Method LineCollide:tlCollisionResult(line:tlLine) | Description: | Check for a collision with another #tlLine | Returns: | tlCollisionResult | Details: | Returns #tlCollisionResult type containing info about the collision Use this to check for a collision with another #tlLine that you pass to the method. You can then use the information stored in #tlCollisionResult to perform various things based on the result of the collision check.
|
|
Method New(x1:Float, y1:Float, x2:Float, y2:Float, layer:Int = tlLAYER_0, data:Object = Null) | Description: | Create a #tlLine | Details: | Returns New #tlLine Create a new #tlLine at the coordinates given, x1 and y1 being the start of the line and x2 and y2 being the end. The will placed exactly according to the coordinates you give, but it's worth bearing in mind that the handle of the line will be at the center point along the line. Therefore the world coordinates will be set to half way point along the line. You can also assign some data to the boundary as handy way to store some extra info about the boundary.
|
|
Method PolyCollide:tlCollisionResult(poly:tlPolygon) | Description: | Check for a collision with a #tlPoly | Returns: | tlCollisionResult | Details: | Returns #tlCollisionResult type containing info about the collision Use this to check for a collision with a #tlPoly that you pass to the method. You can then use the information stored in #tlCollisionResult to perform various things based on the result of the collision check.
|
|
Method RayCollide:tlCollisionResult(px:Float, py:Float, dx:Float, dy:Float, maxdistance:Float = 0) | Description: | See is a ray collides with this #tlLine | Returns: | tlCollisionResult | Details: | Returns #tlCollisionResult with the results of the collision You can use this to test for a collision with a ray. Pass the origin of the ray with px and py, and set the direction of the ray with dx and dy. dx and dy will be normalised and extended infinitely, if maxdistance equals 0 (default), otherwise set maxdistance to how ever far you want the ray to extend to. If the ray starts inside the poly then result.rayorigininside will be set to true.
|
|
Class tlPolygon Extends tlBox |
Description: | Collision polygon class |
Table of contents: | Methods:
- BoxCollide ( Method BoxCollide:tlCollisionResult(Box:tlBox) )
- CircleCollide ( Method CircleCollide:tlCollisionResult(circle:tlCircle) )
- Draw ( Method Draw(offsetx:Float = 0, offsety:Float = 0, boundingbox:Int = False) )
- LineCollide ( Method LineCollide:tlCollisionResult(Line:tlLine) )
- Move ( Method Move(x:Float, y:Float) )
- New ( Method New(x:Float, y:Float, verts:Float[], layer:Int = tlLAYER_0, data:Object = Null, centerhandle:Int = True) )
- New ( Method New(verts:Float[], layer:Int = tlLAYER_0, data:Object = Null) )
- PointInside ( Method PointInside:Int(x:Float, y:Float) )
- PolyCollide ( Method PolyCollide:tlCollisionResult(poly:tlPolygon) )
- RayCollide ( Method RayCollide:tlCollisionResult(px:Float, py:Float, dx:Float, dy:Float, maxdistance:Float = 0) )
- Rotate ( Method Rotate(angle:Float) )
- SetAngle ( Method SetAngle(angle:Float) )
- SetPosition ( Method SetPosition(x:Float, y:Float) )
- SetScale ( Method SetScale(x:Float, y:Float) )
|
Method BoxCollide:tlCollisionResult(Box:tlBox) | Description: | Check for a collision with a #tlBox | Returns: | tlCollisionResult | Details: | Returns #tlCollisionResult type containing info about the collision Use this to check for a collision with a #tlBox that you pass to the method. You can then use the information stored in #tlCollisionResult to perform various things based on the result of the collision check.
|
|
Method CircleCollide:tlCollisionResult(circle:tlCircle) | Description: | Check for a collision with a #tlCircle | Returns: | tlCollisionResult | Details: | Returns #tlCollisionResult type containing info about the collision Use this to check for a collision with a #tlCircle that you pass to the method. You can then use the information stored in #tlCollisionResult to perform various things based on the result of the collision check.
|
|
Method Draw(offsetx:Float = 0, offsety:Float = 0, boundingbox:Int = False) | Description: | Draw the polygon | Returns: | Int | Details: | You can use this for debugging purposes. Pass true of false to draw the bounding box as well.
|
|
Method LineCollide:tlCollisionResult(Line:tlLine) | Description: | Check for a collision with a #tlLine | Returns: | tlCollisionResult | Details: | Returns #tlCollisionResult type containing info about the collision Use this to check for a collision with a #tlLine that you pass to the method. You can then use the information stored in #tlCollisionResult to perform various things based on the result of the collision check.
|
|
Method Move(x:Float, y:Float) | Description: | Move the bounding box by a given amount. | Returns: | Int | Details: | This sets the position of the top left corner of the bounding box by moving it by the x and y amount. If the box is within quadtree it will automatically update itself within it.
|
|
Method New(x:Float, y:Float, verts:Float[], layer:Int = tlLAYER_0, data:Object = Null, centerhandle:Int = True) | Description: | Create a #tlPolygon | Details: | 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, but this can be changed with #SetPolyHandle. 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]. You can also assign some data to the boundary as handy way to store some extra info about the boundary.
|
|
Method New(verts:Float[], layer:Int = tlLAYER_0, data:Object = Null) | Description: | Create a #tlPolygon | Details: | 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, but this can be changed with #SetPolyHandle. 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]. You can also assign some data to the boundary as handy way to store some extra info about the boundary.
|
|
Method PointInside:Int(x:Float, y:Float) | Description: | Find out if a point resides withing the #tlPolygon | Returns: | Int | Details: | Returns True if they do overlap Use this to check if a point with the given coordinates lies within the polygon
|
|
Method PolyCollide:tlCollisionResult(poly:tlPolygon) | Description: | Check for a collision with another #tlpolygon | Returns: | tlCollisionResult | Details: | Returns #tlCollisionResult type containing info about the collision Use this to check for a collision with a #tlPolygon that you pass to the method. You can then use the information stored in #tlCollisionResult to perform various things based on the result of the collision check.
|
|
Method RayCollide:tlCollisionResult(px:Float, py:Float, dx:Float, dy:Float, maxdistance:Float = 0) | Description: | See is a ray collides with this #tlpolygon | Returns: | tlCollisionResult | Details: | Returns #tlCollisionResult with the results of the collision You can use this to test for a collision with a ray. Pass the origin of the ray with px and py, and set the direction of the ray with dx and dy. dx and dy will be normalised and extended infinitely, if maxdistance equals 0 (default), otherwise set maxdistance to how ever far you want the ray to extend to. If the ray starts inside the poly then result.rayorigininside will be set to true.
|
|
Method Rotate(angle:Float) | Description: | Rotate the polygon | Returns: | Int | Details: | This will rotate the polygon by the given amount
|
|
Method SetAngle(angle:Float) | Description: | Set the angle of the polygon | Returns: | Int | Details: | This will adjust the angle of the polygon by the given amount.
|
|
Method SetPosition(x:Float, y:Float) | Description: | Set the position of the bounding box. | Returns: | Int | Details: | This sets the position of the top left corner of the bounding box. If the box is within quadtree it will automatically update itself within it.
|
|
Method SetScale(x:Float, y:Float) | Description: | Set the scale of the Polygon | Returns: | Int | Details: | This sets scale of the polygon.
|
|