Find the first object in the given object layer that satisfies the provided testing function.
I.e. finds the first object for which callback
returns true. Similar to
Array.prototype.find in vanilla JS.
name | type | arguments | description |
---|---|---|---|
objectLayer | string | Phaser.Tilemaps.ObjectLayer |
The name of an object layer (from Tiled) or an ObjectLayer instance. |
|
callback | TilemapFindCallback |
The callback. Each object in the given area will be passed to this callback as the first and only parameter. |
|
context | object | <optional> |
The context under which the callback should be run. |
An object that matches the search, or null if no object found.