Cocos2d JS 之消灭星星(十二) 游戏帮助

前面游戏的各个部分都完善了,游戏共一百关,后面还有使用粒子系统的部分,给游戏添加特效;写得有点粗糙

 1 /*
 2  * @游戏帮助说明
 3  */
 4 var GameHelpLayout = ccui.Layout.extend(
 5 {
 6     ctor:function()
 7     {
 8         this._super();
 9         this.zinit();
10         this.setBackButton();
11     },
12     //还回按钮
13     setBackButton:function()
14     {
15         var backButton = new myButton(res.returnBtn);
16         backButton.x = 480 - backButton.width - 10;
17         backButton.y = 10;
18         this.addChild(backButton, 1);
19         backButton.addTouchEventListener(this.backButtonFunc, this);
20     },
21     //
22     backButtonFunc:function(target,state)
23     {
24         if(state == ccui.Widget.TOUCH_ENDED)
25         {
26             var newGameScene = GameInitializeScene.createScene();
27             cc.director.runScene(cc.TransitionFade.create(1, newGameScene));
28         }
29     },
30     zinit:function()
31     {
32         this.setSize(cc.size(480, 800));
33         var bg = new myImage(res.helpbg);
34         this.addChild(bg, 0);
35     }
36 });
37 
38 GameHelpLayout.createScene = function()
39 {
40     var layout = new GameHelpLayout();
41     var scene = cc.Scene.create();
42     scene.addChild(layout);
43     return scene;
44 }

原文地址:https://www.cnblogs.com/zfsSuperDream/p/4108543.html