File tree Expand file tree Collapse file tree
v3/src/gameobjects/tilemap Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -85,7 +85,6 @@ var Tile = new Class({
8585 */
8686 this . baseHeight = ( baseHeight !== undefined ) ? baseHeight : height ;
8787
88-
8988 /**
9089 * The world x coordinate of the top left of this tile in pixels. This does not factor in
9190 * camera scroll, layer scale or layer position.
Original file line number Diff line number Diff line change @@ -1047,7 +1047,7 @@ var Tilemap = new Class({
10471047
10481048 /**
10491049 * Sets the base tile size for the map. Note: this does not necessarily match the tileWidth and
1050- * tileHeight for all layers.
1050+ * tileHeight for all layers. This also updates the base size on all tiles across all layers.
10511051 *
10521052 * @param {integer } tileWidth - The width of the tiles the map uses for calculations.
10531053 * @param {integer } tileHeight - The height of the tiles the map uses for calculations.
@@ -1060,6 +1060,26 @@ var Tilemap = new Class({
10601060 this . widthInPixels = this . width * tileWidth ;
10611061 this . heightInPixels = this . height * tileHeight ;
10621062
1063+ // Update the base tile size on all tiles
1064+ for ( var i = 0 ; i < this . layers . length ; i ++ )
1065+ {
1066+ var mapData = this . layers [ i ] . data ;
1067+ var mapWidth = this . layers [ i ] . width ;
1068+ var mapHeight = this . layers [ i ] . height ;
1069+
1070+ for ( var row = 0 ; row < mapHeight ; ++ row )
1071+ {
1072+ for ( var col = 0 ; col < mapWidth ; ++ col )
1073+ {
1074+ var tile = mapData [ row ] [ col ] ;
1075+ if ( tile !== null )
1076+ {
1077+ tile . setSize ( undefined , undefined , tileWidth , tileHeight ) ;
1078+ }
1079+ }
1080+ }
1081+ }
1082+
10631083 return this ;
10641084 } ,
10651085
You can’t perform that action at this time.
0 commit comments