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 }
时间: 2024-08-04 14:23:03

Cocos2d JS 之消灭星星(十二) 游戏帮助的相关文章

Cocos2d JS 之消灭星星(十) 关卡配置

关卡配置,包括每个关卡的通关分数和当前关卡的星星数量 1 /* 2 * 关卡配置 3 * 每一关的通过分数和星星数量配置档 4 */ 5 var levelData = 6 [ 7 {level:1, standards:1000, starNumber:4}, 8 {level:2, standards:3000, starNumber:4}, 9 {level:3, standards:5000, starNumber:4}, 10 {level:4, standards:7000, sta

Cocos2d JS 之消灭星星(九) 处理星星类之——移动和消灭星星

1 /* 2 * 本层拥有处理星星的实例化以及对星星的操作 3 * 1/排列星星 4 * 2/移动和删除星星 5 */ 6 var GameStarLayout = ccui.Layout.extend( 7 { 8 size:null, 9 starArr:[],//存放点击与被点击状态的星星资源 10 starObjArr:[],//存放游戏中星星的二位数组 11 firstTouchStar:null,//第一次选择的星星,用于判断两次选择的星星颜色是否一致 12 isSelected:f

Cocos2d JS 之消灭星星(七) 处理星星类之——排列星星

1 /* 2 * 本层拥有处理星星的实例化以及对星星的操作 3 */ 4 var GameStarLayout = ccui.Layout.extend( 5 { 6 size:null, 7 starArr:[],//存放点击与被点击状态的星星资源 8 starObjArr:[],//存放游戏中星星的二位数组 9 ctor:function() 10 { 11 this._super(); 12 this.zinit(); 13 this.layoutStar(); 14 }, 15 //将星

Cocos2d JS 之消灭星星(六) 创建星星类

1 /* 2 * 创建星星类(所有的星星都在这里创建,星星拥有的所有性都在这里实现) 3 */ 4 var GameCreateStar = ccui.ImageView.extend( 5 { 6 type:0,//星星的类型(不同数字代表不同颜色的星星); 7 isSelected:false,//是否选中 8 col:null,//水平方向排列位置(0-9) 9 row:null,//竖直方向排列位置(0-9) 10 normal:null,//通常状态图片纹理 11 selected:n

Cocos2d JS 之消灭星星(五) 游戏主场景

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 Ga

Cocos2d JS 之消灭星星(三) 进入游戏过渡场景

1 /* 2 * 游戏过渡场景,主要作用是在每次进入游戏或者进入下一关卡时进行过渡,显示当前的关卡以及通过该关卡要达到的分数; 3 */ 4 var TransitionScene = ccui.Layout.extend( 5 { 6 size:null, 7 ctor:function() 8 { 9 this._super(); 10 this.zinit(); 11 this.setLabel(); 12 this.gotoGameMainScene(); 13 }, 14 //设置显示

Cocos2d JS 之消灭星星(四) 游戏主场景顶部显示

1 /* 2 * 游戏主场景顶部显示信息 3 */ 4 var GameTopInformation = ccui.Layout.extend( 5 { 6 size:null, 7 isPause:false,//是否暂停游戏 8 maxScoreLabel:null,//最高纪录 9 getScoreNum:null,//当前得分 10 currentLevel:null,//当前关卡 11 ctor:function() 12 { 13 this._super(); 14 this.zin

Cocos2d JS 之消灭星星(十一) 本地保存玩家信息

当玩家退去游戏后,下次进入游戏可以接着上一次的游戏进度继续游戏; 1 /* 2 * win7下本地存储玩家的数据 3 */ 4 var PlayerLocalData = {}; 5 /* 6 * 玩家数据结构 7 */ 8 var playerData = function() 9 { 10 var playerD = [ 11 { 12 currentLevel:1, //玩家关卡 13 gameScore:0, //游戏得分 14 maxScore:0 //游戏最高得分 15 }]; 16

读书笔记 - js高级程序设计 - 第十二章 DOM2和DOM3

Node类型的变化   访问元素的样式 myDiv.style.backgroundColor = "red" myDiv.style.width = "100px" 计算的样式 记住所有计算的样式都是只读的 偏移量 offsetHeight 外边框外 offsetWidth offsetLeft  外边框外 到 左端 offsetTop  客户区的大小 clientWidth  内边框外缘 clientHeight 内边框外缘 滚动大小 scrollHeight