Class Index | File Index

Classes


Namespace collide

Test for collisions between arrays of entities. Each collision method accept two arrays of entities. Every entity in the first array will be tested for collisions against every entity in the second array. The two arrays can also be the same to test every entity against every other. When a collision is found between two entities, the collide_xxxx() method will be called on each entity involved in the collision, where "xxxx" is the type of collision (e.g. collide_aabb(), collide_circle(), collide_polygon()). The first argument is the other entity in the collision, and the second argument is the result returned from the collision, which depends on the type of collision (e.g. might be penetration depth or points or just boolean).
Defined in: collisions.js.

Namespace Summary
Constructor Attributes Constructor Name and Description
 
Method Summary
Method Attributes Method Name and Description
<static>  
collide.aabb(a, b)
Axis-aligned bounding-box collision between two arrays of entities.
<static>  
collide.circles(a, b)
Circle collision test between two groups of entities.
<static>  
collide.polys(a, b)
Polygon collision tests whether two entities defined by polygons are touching.
Namespace Detail
collide
Method Detail
<static> collide.aabb(a, b)
Axis-aligned bounding-box collision between two arrays of entities. This expects entities to have a method called get_collision_aabb() which should return a rectangle of the boundaries of the entity with the form [x, y, w, h].
Parameters:
a
is an array of entities
b
is an array of entities that will be collided with those in group a

<static> collide.circles(a, b)
Circle collision test between two groups of entities. This expects entities to have a method called get_collision_circle() which should return the center of the circle and the radius like this: return [[x, y], r].
Parameters:
a
is an array of entities
b
is an array of entities that will be collided with those in group a

<static> collide.polys(a, b)
Polygon collision tests whether two entities defined by polygons are touching. Entities should have a get_collision_poly() method which should return an array of lines of the form [[x1, y1], [x2, y2], ... [xn, yn]].
Parameters:
a
is an array of entities
b
is an array of entities that will be collided with those in group a

Documentation generated by JsDoc Toolkit 2.4.0 on Fri Nov 09 2012 21:19:31 GMT+0800 (WST)