Physics.Ninja#overlap()

overlap(object1, object2, overlapCallback, processCallback, callbackContext) → {boolean}

Checks for overlaps between two game objects. The objects can be Sprites, Groups or Emitters.
You can perform Sprite vs. Sprite, Sprite vs. Group and Group vs. Group overlap checks.
Unlike collide the objects are NOT automatically separated or have any physics applied, they merely test for overlap results.
The second parameter can be an array of objects, of differing types.

Parameters
Name Type Argument Default Description
object1 Phaser.Sprite | Phaser.Group | Phaser.Particles.Emitter

The first object to check. Can be an instance of Phaser.Sprite, Phaser.Group or Phaser.Particles.Emitter.

object2 Phaser.Sprite | Phaser.Group | Phaser.Particles.Emitter | array

The second object or array of objects to check. Can be Phaser.Sprite, Phaser.Group or Phaser.Particles.Emitter.

overlapCallback function <optional>
null

An optional callback function that is called if the objects overlap. The two objects will be passed to this function in the same order in which you specified them.

processCallback function <optional>
null

A callback function that lets you perform additional checks against the two objects if they overlap. If this is set then overlapCallback will only be called if processCallback returns true.

callbackContext object <optional>

The context in which to run the callbacks.

Returns
boolean -

True if an overlap occured otherwise false.

Source code: physics/ninja/World.js (Line 291)
doc_phaser
2017-02-14 10:59:59
Comments
Leave a Comment

Please login to continue.