mirror of
https://github.com/photonstorm/phaser
synced 2024-12-23 11:33:28 +00:00
18 lines
448 B
JavaScript
18 lines
448 B
JavaScript
|
// Internal method
|
||
|
// Update layer.collideIndexes to either contain or not contain tileIndex
|
||
|
var SetLayerCollisionIndex = function (tileIndex, collides, layer)
|
||
|
{
|
||
|
var loc = layer.collideIndexes.indexOf(tileIndex);
|
||
|
|
||
|
if (collides && loc === -1)
|
||
|
{
|
||
|
layer.collideIndexes.push(tileIndex);
|
||
|
}
|
||
|
else if (!collides && loc !== -1)
|
||
|
{
|
||
|
layer.collideIndexes.splice(loc, 1);
|
||
|
}
|
||
|
};
|
||
|
|
||
|
module.exports = SetLayerCollisionIndex;
|