用cocos2d-html5做的消除类游戏《英雄爱消除》(1)——系统主菜单(2)

来源:未知 责任编辑:责任编辑 发表时间:2015-01-01 13:14 点击:

p>                this.onButtonEffect();

p>                flareEffect(this, this, this.onNewGame);

p>            }.bind(this));

p> 

p>            var gameSettings = cc.MenuItemSprite.create(gameSettingsNormal, gameSettingsSelected, gameSettingsDisabled, this.onSettings, this);

p>            var about = cc.MenuItemSprite.create(aboutNormal, aboutSelected, aboutDisabled, this.onAbout, this);

p> 

p>            //系统菜单

p>            var menu = cc.Menu.create(newGame, gameSettings, about);

p>            menu.alignItemsVerticallyWithPadding(10);

p>            this.addChild(menu, 1, 2);

p>            menu.setPosition(winSize.width / 2 , winSize.height / 2 - 80);

p> 

p>            //logo动画

p>            this.bigImgLen = LLK.CONTAINER.BIGIMAGES.length;

p>            this._logo = cc.Sprite.createWithSpriteFrameName(LLK.CONTAINER.BIGIMAGES[Math.floor( Math.random()*this.bigImgLen)]);

p>            this._logo.setAnchorPoint(cc.p(0, 0));

p>            this._logo.setPosition(winSize.width/2 -100, 300);

p>            this.addChild(this._logo, 10, 1);

p> 

p>            var animFrames = []; //      将所有帧存入一个数组

p>            for (var i=0;i<this.bigImgLen;i++) {

p>                //采用循环添加动画的每一帧

p>                var frame =this._logoFrameCache.getSpriteFrame(LLK.CONTAINER.BIGIMAGES[i]);

p>                if (frame) {

p>                    animFrames.push(frame);

p>                }

p>            }

p>            //        创建动画,设置播放间隔

p>            var animation = cc.Animation.create(animFrames, 1);

p>            // animation.setDelayPerUnit(0.1);

p>            //设置动画播放完成是否保持在第一帧,true为保持在第一帧,false为保持在最后一帧

p>            //animation.setRestoreOriginalFrame(false);

p>            this._logo.runAction(cc.RepeatForever.create(cc.Animate.create(animation)));

p> 

p>            if (LLK.SOUND) {
发表评论
请自觉遵守互联网相关的政策法规,严禁发布色情、暴力、反动的言论。
用户名: 验证码:点击我更换图片
最新评论 更多>>

推荐热点

  • cocos2d-x学习笔记(19)--label 、label atlas
  • cocos2d-x学习笔记(23)--地图的使用3--CCTMXLayer
  • Cocos2d-x学习(一):HelloWorld
  • cocos2dx在xcode下开发,编译到android上(2)
  • cocos2d 设置屏幕默认方向
  • cocos2d-x学习笔记(22)--地图的使用2(TMX) --Z-Order、AnchorPoi
  • Cocos2d-x 2.0 之 Actions “三板斧” 之一
  • cocos2d-x学习笔记(18)--游戏打包(windows平台)
  • cocos2d-x学习笔记(16)--spritesheet(精灵表单)
网站首页 - 友情链接 - 网站地图 - TAG标签 - RSS订阅 - 内容搜索
Copyright © 2008-2015 计算机技术学习交流网. 版权所有

豫ICP备11007008号-1