HTML and CSS Reference
In-Depth Information
// add tool bar
this.initToolsBar(); //Add tool bar.
},
initMaps : function(){
this._maps = GameMaps.create();
this._maps.setPosition( cc.p( 0, 30));
this.addChild(this._maps); // Add game map to game layer.
},
initToolsBar : function(){
var toolLayer = cc.Layer.create(); // We will add monsters menu items to this tool
layer later.
var sToolsBar = cc.Sprite.create(s_ToolsBar);
sToolsBar.setPosition( cc.p( this._winSize.width / 2 ,
sToolsBar.getContentSize().height / 2));
toolLayer.addChild(sToolsBar);
this.addChild(toolLayer, 2); // Add toolbar layer into game layer.
}
});
You have created a toolbar layer and add it to game layer. You also defined a initMaps() for Game Map layer, now
let's implement it and add it to the Game layer.
As to Game Map layer, you use the Tile map editor Tiled to create the map (See Figure 24-15 ). You can download
this powerful tool from www.mapeditor.org/download.html .
Figure 24-15. Tower Defence game map
Search WWH ::




Custom Search