phaser/src/tilemaps/components/SetTileCollision.js

30 lines
760 B
JavaScript
Raw Normal View History

2018-02-12 16:01:20 +00:00
/**
* @author Richard Davey <rich@photonstorm.com>
2020-01-15 12:07:09 +00:00
* @copyright 2020 Photon Storm Ltd.
2019-05-10 15:15:04 +00:00
* @license {@link https://opensource.org/licenses/MIT|MIT License}
2018-02-12 16:01:20 +00:00
*/
2017-11-27 13:33:30 +00:00
/**
* Internally used method to set the colliding state of a tile. This does not recalculate
* interesting faces.
2017-11-27 13:33:30 +00:00
*
2018-02-08 01:08:59 +00:00
* @function Phaser.Tilemaps.Components.SetTileCollision
* @since 3.0.0
*
* @param {Phaser.Tilemaps.Tile} tile - The Tile to set the collision on.
* @param {boolean} [collides=true] - Should the tile index collide or not?
2017-11-27 13:33:30 +00:00
*/
var SetTileCollision = function (tile, collides)
{
if (collides)
{
tile.setCollision(true, true, true, true, false);
}
else
{
tile.resetCollision(false);
}
};
module.exports = SetTileCollision;