Added Tilemap.renderDebugFull method.

This commit is contained in:
Richard Davey 2019-04-08 16:05:12 +01:00
parent 95cf972dec
commit 0012ed3524
2 changed files with 30 additions and 0 deletions

View file

@ -66,6 +66,7 @@ Notes:
* `GameObjects.Components.PathFollower` is a new component that manages any type of Game Object following a path. The original Path Follower Game Object has been updated to use this new component directly, but it can be applied to any custom Game Object class.
* `Tilemap.removeLayer` is a new method that allows you to remove a specific layer from a Tilemap without destroying it.
* `Tilemap.destroyLayer` is a new method that allows you to destroy a layer and remove it from a Tilemap.
* `Tilemap.renderDebugFull` is a new method that will debug render all layers in the Tilemap to the given Graphics object.
### Updates

View file

@ -1764,6 +1764,35 @@ var Tilemap = new Class({
return this;
},
/**
* Draws a debug representation of all layers within this Tilemap to the given Graphics object.
*
* This is helpful when you want to get a quick idea of which of your tiles are colliding and which
* have interesting faces. The tiles are drawn starting at (0, 0) in the Graphics, allowing you to
* place the debug representation wherever you want on the screen.
*
* @method Phaser.Tilemaps.Tilemap#renderDebugFull
* @since 3.17.0
*
* @param {Phaser.GameObjects.Graphics} graphics - The target Graphics object to draw upon.
* @param {Phaser.Tilemaps.Types.StyleConfig} styleConfig - An object specifying the colors to use for the debug drawing.
* @param {(string|integer|Phaser.Tilemaps.DynamicTilemapLayer|Phaser.Tilemaps.StaticTilemapLayer)} [layer] - The tile layer to use. If not given the current layer is used.
*
* @return {?Phaser.Tilemaps.Tilemap} Return this Tilemap object, or null if the layer given was invalid.
*/
renderDebugFull: function (graphics, styleConfig)
{
var layers = this.layers;
// Destroy any StaticTilemapLayers or DynamicTilemapLayers that are stored in LayerData
for (var i = 0; i < layers.length; i++)
{
TilemapComponents.RenderDebug(graphics, styleConfig, layers[i]);
}
return this;
},
/**
* Scans the given rectangular area (given in tile coordinates) for tiles with an index matching
* `findIndex` and updates their index to match `newIndex`. This only modifies the index and does