Class: Phaser.Component.Overlap
Constructor
new Overlap()
The Overlap component allows a Game Object to check if it overlaps with the bounds of another Game Object.
- Source code: gameobjects/components/Overlap.js (Line 12)
Public Methods
- Source code: gameobjects/components/Overlap.js (Line 29)
overlap(displayObject) → {boolean}
Checks to see if the bounds of this Game Object overlaps with the bounds of the given Display Object,
which can be a Sprite, Image, TileSprite or anything that extends those such as Button or provides a getBounds
method and result.
This check ignores the hitArea
property if set and runs a getBounds
comparison on both objects to determine the result.
Therefore it's relatively expensive to use in large quantities, i.e. with lots of Sprites at a high frequency.
It should be fine for low-volume testing where physics isn't required.
Parameters
Name | Type | Description |
---|---|---|
displayObject | Phaser.Sprite | Phaser.Image | Phaser.TileSprite | Phaser.Button | PIXI.DisplayObject | The display object to check against. |
Returns
True if the bounds of this Game Object intersects at any point with the bounds of the given display object.
© 2016 Richard Davey, Photon Storm Ltd.
Licensed under the MIT License.
http://phaser.io/docs/2.6.2/Phaser.Component.Overlap.html