Cocos2d JS to eliminate the Stars (iii) into the game transition scene

Source: Internet
Author: User
Tags addchild

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

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.