Physics.Arcade.Body#onOverlap

onOverlap : Phaser.Signal

A Signal that is dispatched when this Body overlaps with another Body.

You still need to call game.physics.arcade.overlap in your update method in order
for this signal to be dispatched.

Usually you'd pass a callback to the overlap method, but this signal provides for
a different level of notification.

Due to the potentially high volume of signals this could create it is disabled by default.

To use this feature set this property to a Phaser.Signal: sprite.body.onOverlap = new Phaser.Signal()
and it will be called when a collision happens, passing two arguments: the sprites which collided.
The first sprite in the argument is always the owner of this Body.

If two Bodies with this Signal set collide, both will dispatch the Signal.

Source code: physics/arcade/Body.js (Line 241)
doc_phaser
2017-02-14 10:59:35
Comments
Leave a Comment

Please login to continue.