-
Notifications
You must be signed in to change notification settings - Fork 7.1k
/
ProcessTileCallbacks.js
35 lines (32 loc) · 1.14 KB
/
ProcessTileCallbacks.js
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
/**
* @author Richard Davey <rich@phaser.io>
* @copyright 2013-2024 Phaser Studio Inc.
* @license {@link https://opensource.org/licenses/MIT|MIT License}
*/
/**
* A function to process the collision callbacks between a single tile and an Arcade Physics enabled Game Object.
*
* @function Phaser.Physics.Arcade.Tilemap.ProcessTileCallbacks
* @since 3.0.0
*
* @param {Phaser.Tilemaps.Tile} tile - The Tile to process.
* @param {Phaser.GameObjects.Sprite} sprite - The Game Object to process with the Tile.
*
* @return {boolean} The result of the callback, `true` for further processing, or `false` to skip this pair.
*/
var ProcessTileCallbacks = function (tile, sprite)
{
// Tile callbacks take priority over layer level callbacks
if (tile.collisionCallback)
{
return !tile.collisionCallback.call(tile.collisionCallbackContext, sprite, tile);
}
else if (tile.layer.callbacks[tile.index])
{
return !tile.layer.callbacks[tile.index].callback.call(
tile.layer.callbacks[tile.index].callbackContext, sprite, tile
);
}
return true;
};
module.exports = ProcessTileCallbacks;