HTML and CSS Reference
In-Depth Information
3. Then, we define the redraw method that visualizes the data:
CityLayer.prototype.redraw = function() {
// loop the 2D array for visualization
for (var i=0; i<this.rows; i++) {
for (var j=0; j<this.cols; j++) {
var tile = new game.Tile();
// layout tiles in rombo shape.
tile.x = (j-i) * game.Tile.width / 2;
tile.y = (j+i) * game.Tile.height / 2;
this.tiles.addChild(tile);
this.viewMap[i][j] = tile;
}
}
};
After performing these steps, the result will be as shown in the following screenshot:
 
Search WWH ::




Custom Search