@@ -3,7 +3,28 @@ var Parse = require('./parsers/Parse');
33var MapData = require ( './mapdata/MapData' ) ;
44var Tilemap = require ( './Tilemap' ) ;
55
6- // Parse from key or data and create a Tilemap. If neither is given, make an empty Tilemap.
6+ /**
7+ * Create a Tilemap from the given key or data. If neither is given, make a blank Tilemap. When
8+ * loading from CSV or a 2D array, you should specify the tileWidth & tileHeight. When parsing from
9+ * a map from Tiled, the tileWidth, tileHeight, width & height will be pulled from the map data. For
10+ * an empty map, you should specify tileWidth, tileHeight, width & height.
11+ *
12+ * @param {Scene } scene - [description]
13+ * @param {string } [key] - The key in the Phaser cache that corresponds to the loaded tilemap data.
14+ * @param {integer } [tileWidth=32] - The width of a tile in pixels.
15+ * @param {integer } [tileHeight=32] - The height of a tile in pixels.
16+ * @param {integer } [width=10] - The width of the map in tiles.
17+ * @param {integer } [height=10] - The height of the map in tiles.
18+ * @param {integer[][] } [data] - Instead of loading from the cache, you can also load directly from
19+ * a 2D array of tile indexes.
20+ * @param {boolean } [insertNull=false] - Controls how empty tiles, tiles with an index of -1, in the
21+ * map data are handled. If `true`, empty locations will get a value of `null`. If `false`, empty
22+ * location will get a Tile object with an index of -1. If you've a large sparsely populated map and
23+ * the tile data doesn't need to change then setting this value to `true` will help with memory
24+ * consumption. However if your map is small or you need to update the tiles dynamically, then leave
25+ * the default value set.
26+ * @returns {Tilemap }
27+ */
728var ParseToTilemap = function ( scene , key , tileWidth , tileHeight , width , height , data , insertNull )
829{
930 if ( tileWidth === undefined ) { tileWidth = 32 ; }
0 commit comments