HTML and CSS Reference
In-Depth Information
// set up 1 building button based on the index and data
// loop the 3 buttons
// *Cancel button while choosing place to build
// *Button for cancel and hide the building panel
// *Button for showing building panel
};
6. We put logic into the setupBuildingPanel funcion one by one:
UILayer.prototype.setupBuildingPanel = function() {
// Building Panels
this.buildingPanel = new cjs.Container();
this.buildingPanel.visible = false; // hide it at initialize.
this.addChild(this.buildingPanel);
var _this = this;
7. We define three sets of the building data. We will loop this data to set up the
butons. Insert the following code into the setupBuildingPanel funcion
following the preceding step:
// building buttons data
var buildings = [ // 3 buttons data into array.
{
name:'PowerSupply', // class name
image: 'power-supply', // image name
x: 20 // x-position of this button
},
{
name:'CoinsGenerator',
image: 'coins-generator',
x: 338
},
{
name:'Merchant',
image: 'merchant',
x: 650
}
];
 
Search WWH ::




Custom Search