So from The phaser Chebyshev distance Example Link, It shows the one Man and the transparency distance.
I tried to expand on the example by having one stationary area and one following the player, code,
function updateMap () {
var origin = map.getTileAtWorldXY(player.x, player.y);
var origin2 = map.getTileAtWorldXY(400, 400);
map.forEachTile(function (tile) {
var dist = Phaser.Math.Distance.Chebyshev(
origin.x,
origin.y,
tile.x,
tile.y
);
tile.setAlpha(tile.alpha+(1 - 0.05 * dist));
});
map.forEachTile(function (tile) {
var dist1 = Phaser.Math.Distance.Chebyshev(
origin2.x,
origin2.y,
tile.x,
tile.y
);
tile.setAlpha(tile.alpha+(1 - 0.05 * dist1));
});
}
So instead of the two squares I expected, One for the player and one for the stationary light, Instead, I get this
Why Does this Happen, And How can i Fix it?