Safari Books Online is a digital library providing on-demand subscription access to thousands of learning resources.
The .checkAgainst property tells
an entity which type property to check
for when it collides with another entity. An entity can check for four
types during the collision:
ig.Entity.TYPE.NONE ig.Entity.TYPE.A ig.Entity.TYPE.B ig.Entity.TYPE.BOTH
The default value is always set to NONE. When two entities overlap, the .checkAgainst property of one entity is compared
with the .type property of the other.
If there is a match, the first entity’s check() method is called, and the latter object
with which it collided is sent to the method as a parameter. You can
customize the check() method to respond
to such a collision
This example, which we’ll discuss in greater detail in a moment, shows damage applied after such a collision:
check: function( other ) {
other.receiveDamage( 10, this );
}