1 /*2 * Game transition scene, the main role is to enter the game or enter the next level when the transition, showing the current level and through the level to achieve the score;3 */4 varTransitionscene =Ccui. Layout.extend (5 {6SizeNULL,7ctorfunction()8 {9 This. _super ();Ten This. Zinit (); One This. SetLabel (); A This. Gotogamemainscene (); - }, - //Set display text (number of current levels, through level score) theSetLabel:function() - { - //Current entry level - varCurrentLevel =NewMyText ("Level 1", White, 20); +currentlevel.x = This. size.width-currentlevel.width >> 1;//Center -CURRENTLEVEL.Y = 500; + This. AddChild (CurrentLevel, 1); A at varTargettxt =NewMyText ("Target score is", White, 20); -Targettxt.x = This. size.width-targettxt.width >> 1; -Targettxt.y = currentlevel.y-targettxt.height-10; - This. AddChild (Targettxt, 1); - //Clearance Score - varTargetscore =NewMyText ("$", white, 20); intargetscore.x = This. size.width-targetscore.width >> 1; -Targetscore.y = targettxt.y-targetscore.height-10; to This. AddChild (Targetscore, 1); + }, - //Enter the game home view theGotogamemainscene:function() * { $ //two seconds to enter the main game screenPanax Notoginseng This. Scheduleonce (function() - { the varGmainscene =Gamemainscene.createscene (); +Cc.director.runScene (CC. Transitionfade.create (1, Gmainscene)); A}, 2); the }, + //Initialize -Zinit:function() $ { $ //Set Layout size - This. Size = Cc.size (480, 800); - This. SetSize ( This. Size); the //instantiate a background picture - varBackGround =Newmyimage (res.mainbacktop);WuyiBackground.y = This. Size.Height-Background.height; the This. AddChild (BackGround, 0); - varBackGround1 =Newmyimage (res.mainbackbottom); Wu This. AddChild (backGround1, 0); - } About }); $ //instantiating a scene -Transitionscene.createscene =function() - { - varTscene =cc. Scene.create (); A varTlayout =NewTransitionscene (); + Tscene.addchild (tlayout); the returnTscene; -};
/******************************effect image****************************/
Cocos2d JS to eliminate the Stars (iii) into the game transition scene