fixed problems with removeTileAt

This commit is contained in:
Svipal 2020-02-05 18:42:20 +01:00
parent aaf512b9cd
commit 5747f7102d
5 changed files with 5 additions and 15 deletions

View file

@ -26609,16 +26609,13 @@ var GetTileAt = function (tileX, tileY, nonNull, layer)
if (IsInLayerBounds(tileX, tileY, layer)) if (IsInLayerBounds(tileX, tileY, layer))
{ {
console.log("tile in bounds", tileX, tileY)
var tile = layer.data[tileY][tileX] || null; var tile = layer.data[tileY][tileX] || null;
if (tile === null) if (tile === null)
{ {
console.log("null tile", tileX, tileY)
return null; return null;
} }
else if (tile.index === -1) else if (tile.index === -1)
{ {
console.log("null tile", tileX, tileY)
return nonNull ? tile : null; return nonNull ? tile : null;
} }
else else
@ -47879,8 +47876,6 @@ var ParseToTilemap = function (scene, key, tileWidth, tileHeight, width, height,
width: width, width: width,
height: height height: height
}); });
} else {
console.log(mapData.orientation)
} }
return new Tilemap(scene, mapData); return new Tilemap(scene, mapData);
@ -102769,7 +102764,7 @@ var RemoveTileAt = function (tileX, tileY, replaceWithNull, recalculateFaces, la
} }
else else
{ {
layer.data[tileY][tileX] = (replaceWithNull) ? null : new Tile(layer, -1, tileX, tileY, tile.width, tile.height); layer.data[tileY][tileX] = (replaceWithNull) ? null : new Tile(layer, -1, tileX, tileY, layer.tileWidth, layer.tileHeight);
} }
// Recalculate faces only if the removed tile was a colliding tile // Recalculate faces only if the removed tile was a colliding tile

File diff suppressed because one or more lines are too long

7
dist/phaser.js vendored
View file

@ -29718,16 +29718,13 @@ var GetTileAt = function (tileX, tileY, nonNull, layer)
if (IsInLayerBounds(tileX, tileY, layer)) if (IsInLayerBounds(tileX, tileY, layer))
{ {
console.log("tile in bounds", tileX, tileY)
var tile = layer.data[tileY][tileX] || null; var tile = layer.data[tileY][tileX] || null;
if (tile === null) if (tile === null)
{ {
console.log("null tile", tileX, tileY)
return null; return null;
} }
else if (tile.index === -1) else if (tile.index === -1)
{ {
console.log("null tile", tileX, tileY)
return nonNull ? tile : null; return nonNull ? tile : null;
} }
else else
@ -52169,8 +52166,6 @@ var ParseToTilemap = function (scene, key, tileWidth, tileHeight, width, height,
width: width, width: width,
height: height height: height
}); });
} else {
console.log(mapData.orientation)
} }
return new Tilemap(scene, mapData); return new Tilemap(scene, mapData);
@ -107580,7 +107575,7 @@ var RemoveTileAt = function (tileX, tileY, replaceWithNull, recalculateFaces, la
} }
else else
{ {
layer.data[tileY][tileX] = (replaceWithNull) ? null : new Tile(layer, -1, tileX, tileY, tile.width, tile.height); layer.data[tileY][tileX] = (replaceWithNull) ? null : new Tile(layer, -1, tileX, tileY, layer.tileWidth, layer.tileHeight);
} }
// Recalculate faces only if the removed tile was a colliding tile // Recalculate faces only if the removed tile was a colliding tile

2
dist/phaser.min.js vendored

File diff suppressed because one or more lines are too long

View file

@ -42,7 +42,7 @@ var RemoveTileAt = function (tileX, tileY, replaceWithNull, recalculateFaces, la
} }
else else
{ {
layer.data[tileY][tileX] = (replaceWithNull) ? null : new Tile(layer, -1, tileX, tileY, tile.width, tile.height); layer.data[tileY][tileX] = (replaceWithNull) ? null : new Tile(layer, -1, tileX, tileY, layer.tileWidth, layer.tileHeight);
} }
// Recalculate faces only if the removed tile was a colliding tile // Recalculate faces only if the removed tile was a colliding tile