Skip to content

Commit 9ac505d

Browse files
authored
Build is requiring me to pre-declare x, y, tile.
1 parent 4fa3dc7 commit 9ac505d

1 file changed

Lines changed: 10 additions & 6 deletions

File tree

src/tilemaps/components/CullTiles.js

Lines changed: 10 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -27,6 +27,10 @@ var CullTiles = function (layer, camera, outputArray)
2727

2828
outputArray.length = 0;
2929

30+
var y = 0;
31+
var x = 0;
32+
var tile = null;
33+
3034
var tilemapLayer = layer.tilemapLayer;
3135

3236
var tileW = Math.floor(layer.tileWidth * tilemapLayer.scaleX);
@@ -47,11 +51,11 @@ var CullTiles = function (layer, camera, outputArray)
4751

4852
if(tilemapLayer.skipCull)
4953
{
50-
for (var y = 0; y < mapHeight; y++)
54+
for (y = 0; y < mapHeight; y++)
5155
{
52-
for (var x = 0; x < mapWidth; x++)
56+
for (x = 0; x < mapWidth; x++)
5357
{
54-
var tile = mapData[y][x];
58+
tile = mapData[y][x];
5559

5660
if (!tile || tile.index === -1 || !tile.visible || tile.alpha === 0)
5761
{
@@ -69,11 +73,11 @@ var CullTiles = function (layer, camera, outputArray)
6973
var drawTop = Math.max(0, boundsTop / layer.tileHeight);
7074
var drawBottom = Math.min(mapHeight, boundsBottom / layer.tileHeight);
7175

72-
for (var y = drawTop; y < drawBottom; y++)
76+
for (y = drawTop; y < drawBottom; y++)
7377
{
74-
for (var x = drawLeft; x < drawRight; x++)
78+
for (x = drawLeft; x < drawRight; x++)
7579
{
76-
var tile = mapData[y][x];
80+
tile = mapData[y][x];
7781

7882
if (!tile || tile.index === -1 || !tile.visible || tile.alpha === 0)
7983
{

0 commit comments

Comments
 (0)