標籤:style blog io color os ar for sp div
1 /* 2 * 遊戲主情境 3 */ 4 var GameMainScene = ccui.Layout.extend( 5 { 6 ctor:function() 7 { 8 this._super(); 9 this.zinit();10 this.setTopInfor();11 this.addStarLayout();12 },13 //遊戲主情境頂部顯示資訊14 setTopInfor:function()15 {16 var gameTopInfo = new GameTopInformation();17 gameTopInfo.y = this.size.height - gameTopInfo.height;18 this.addChild(gameTopInfo, 1);19 },20 //將星星層添加到主情境21 addStarLayout:function()22 {23 var starLayout = GameStarLayout.createLayout();24 this.addChild(starLayout, 1);25 },26 //初始化27 zinit:function()28 {29 //設定布局大小30 this.size = cc.size(480, 800);31 this.setSize(this.size);32 //執行個體化背景圖片33 var backGround = new myImage(res.mainbacktop);34 backGround.y = this.size.height - backGround.height;35 this.addChild(backGround, 0);36 var backGround1 = new myImage(res.mainbackbottom);37 this.addChild(backGround1, 0);38 }39 });40 41 42 GameMainScene.createScene = function()43 {44 var gameLayout = new GameMainScene();45 var scene = cc.Scene.create();46 scene.addChild(gameLayout);47 return scene;48 };
Cocos2d JS 之消滅星星(五) 遊戲主情境