CheckIsoBounds after checking if the iso tile will be visible

This commit is contained in:
Robert Kowalski 2024-01-31 11:34:21 -05:00
parent 7420a998c7
commit ab0ce4d335
2 changed files with 46 additions and 37 deletions

View file

@ -10,7 +10,8 @@
* The `dropped` argument has now been adeded to the documentation for the `DRAG_END` and `GAMEOBJECT_DRAG_END` events (thanks @samme)
* `Container.onChildDestroyed` is a new internal method used to destroy Container children. Previously, if you destroyed a Game Object in an exclusive Container, the game object would (momentarily) move onto the Scene display list and emit an ADDED_TO_SCENE event. Also, if you added a Sprite to a non-exclusive Container and stopped the Scene, you would get a TypeError (evaluating 'this.anims.destroy'). This happened because the fromChild argument in the DESTROY event was misinterpreted as destroyChild in the Container's remove(), and the Container was calling the Sprite's destroy() again. (thanks @samme)
* The `Text` and `TileSprite` Game Objects now place their textures into the global `TextureManager` and a `_textureKey` private string property has been added which contains a UUID to reference that texture.
* `Tilemaps.Components.WeightedRandomize` now uses the Phaser `Math.RND.frac` method with a seed instead the `Math.Random` static method. (thanks @jorbascrumps)
* `Tilemaps.Components.WeightedRandomize` now uses the Phaser `Math.RND.frac` method with a seed instead of the `Math.Random` static method. (thanks @jorbascrumps)
* `Tilemaps.Components.IsometricCullTiles` does the `CheckIsoBounds` method check last when building the outputArray, as to help optimize in situations where the tile would not be visible anyways. (thanks @zegenie)
# Bug Fixes

View file

@ -50,17 +50,19 @@ var IsometricCullTiles = function (layer, camera, outputArray, renderOrder)
{
for (x = drawLeft; x < drawRight; x++)
{
if (skipCull || CheckIsoBounds(x, y, layer, camera))
tile = mapData[y][x];
if (!tile || tile.index === -1 || !tile.visible || tile.alpha === 0)
{
tile = mapData[y][x];
if (!tile || tile.index === -1 || !tile.visible || tile.alpha === 0)
{
continue;
}
outputArray.push(tile);
continue;
}
if (!skipCull && !CheckIsoBounds(x, y, layer, camera))
{
continue;
}
outputArray.push(tile);
}
}
}
@ -72,17 +74,19 @@ var IsometricCullTiles = function (layer, camera, outputArray, renderOrder)
{
for (x = drawRight; x >= drawLeft; x--)
{
if (skipCull || CheckIsoBounds(x, y, layer, camera))
tile = mapData[y][x];
if (!tile || tile.index === -1 || !tile.visible || tile.alpha === 0)
{
tile = mapData[y][x];
if (!tile || tile.index === -1 || !tile.visible || tile.alpha === 0)
{
continue;
}
outputArray.push(tile);
continue;
}
if (!skipCull && !CheckIsoBounds(x, y, layer, camera))
{
continue;
}
outputArray.push(tile);
}
}
}
@ -94,17 +98,19 @@ var IsometricCullTiles = function (layer, camera, outputArray, renderOrder)
{
for (x = drawLeft; x < drawRight; x++)
{
if (skipCull || CheckIsoBounds(x, y, layer, camera))
tile = mapData[y][x];
if (!tile || tile.index === -1 || !tile.visible || tile.alpha === 0)
{
tile = mapData[y][x];
if (!tile || tile.index === -1 || !tile.visible || tile.alpha === 0)
{
continue;
}
outputArray.push(tile);
continue;
}
if (!skipCull && !CheckIsoBounds(x, y, layer, camera))
{
continue;
}
outputArray.push(tile);
}
}
}
@ -116,17 +122,19 @@ var IsometricCullTiles = function (layer, camera, outputArray, renderOrder)
{
for (x = drawRight; x >= drawLeft; x--)
{
if (skipCull || CheckIsoBounds(x, y, layer, camera))
tile = mapData[y][x];
if (!tile || tile.index === -1 || !tile.visible || tile.alpha === 0)
{
tile = mapData[y][x];
if (!tile || tile.index === -1 || !tile.visible || tile.alpha === 0)
{
continue;
}
outputArray.push(tile);
continue;
}
if (!skipCull && !CheckIsoBounds(x, y, layer, camera))
{
continue;
}
outputArray.push(tile);
}
}
}