1 /*2 * Game Home View3 */4 varGamemainscene =Ccui. Layout.extend (5 {6ctorfunction()7 {8 This. _super ();9 This. Zinit ();Ten This. Settopinfor (); One This. Addstarlayout (); A }, - //display information at the top of the game's main scene -Settopinfor:function() the { - varGametopinfo =Newgametopinformation (); -GAMETOPINFO.Y = This. Size.Height-Gametopinfo.height; - This. AddChild (Gametopinfo, 1); + }, - //Add the star layer to the home view +Addstarlayout:function() A { at varStarlayout =gamestarlayout.createlayout (); - This. AddChild (Starlayout, 1); - }, - //Initialize -Zinit:function() - { in //Set Layout size - This. Size = Cc.size (480, 800); to This. SetSize ( This. Size); + //instantiate a background picture - varBackGround =Newmyimage (res.mainbacktop); theBackground.y = This. Size.Height-Background.height; * This. AddChild (BackGround, 0); $ varBackGround1 =Newmyimage (res.mainbackbottom);Panax Notoginseng This. AddChild (backGround1, 0); - } the }); + A theGamemainscene.createscene =function() + { - varGamelayout =NewGamemainscene (); $ varScene =cc. Scene.create (); $ Scene.addchild (gamelayout); - returnscene; -};
Cocos2d JS to eliminate the Stars (v) game main scene