You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Tilemap.removeTile is a new method that allows you to remove a tile, or an array of tiles, by passing in references to the tiles themselves, rather than coordinates. The tiles can be replaced with new tiles of the given index, or removed entirely, and the method can optionally recalculate interesting faces on the layer.
Copy file name to clipboardExpand all lines: src/tilemaps/Tilemap.js
+43-1Lines changed: 43 additions & 1 deletion
Original file line number
Diff line number
Diff line change
@@ -1566,6 +1566,48 @@ var Tilemap = new Class({
1566
1566
returnthis;
1567
1567
},
1568
1568
1569
+
/**
1570
+
* Removes the given Tile, or an array of Tiles, from the layer to which they belong,
1571
+
* and optionally recalculates the collision information.
1572
+
*
1573
+
* This cannot be applied to Tiles that belong to Static Tilemap Layers.
1574
+
*
1575
+
* @method Phaser.Tilemaps.Tilemap#removeTile
1576
+
* @since 3.16.3
1577
+
*
1578
+
* @param {(Phaser.Tilemaps.Tile|Phaser.Tilemaps.Tile[])} tiles - The Tile to remove, or an array of Tiles.
1579
+
* @param {integer} [replaceIndex=-1] - After removing the Tile, insert a brand new Tile into its location with the given index. Leave as -1 to just remove the tile.
1580
+
* @param {boolean} [recalculateFaces=true] - `true` if the faces data should be recalculated.
1581
+
*
1582
+
* @return {Phaser.Tilemaps.Tile[]} Returns an array of Tiles that were removed.
* Removes the tile at the given tile coordinates in the specified layer and updates the layer's
1571
1613
* collision information.
@@ -1582,7 +1624,7 @@ var Tilemap = new Class({
1582
1624
* @param {boolean} [recalculateFaces=true] - `true` if the faces data should be recalculated.
1583
1625
* @param {(string|integer|Phaser.Tilemaps.DynamicTilemapLayer|Phaser.Tilemaps.StaticTilemapLayer)} [layer] - The tile layer to use. If not given the current layer is used.
1584
1626
*
1585
-
* @return {?Phaser.Tilemaps.Tile} Returns a Tile, or null if the layer given was invalid.
1627
+
* @return {?Phaser.Tilemaps.Tile} Returns the Tile that was removed, or null if the layer given was invalid.
0 commit comments