当前位置: 首页 > news >正文

新宁县建设局网站西安今日头条最新新闻

新宁县建设局网站,西安今日头条最新新闻,开封网站建设哪家好,一个设计公司需要多少人当年一款手机节奏音游,相信不少人都玩过或见过。最近也是将其做了出来分享给大家。 游戏的基本玩法:点击下落的黑色方块,弹奏音乐。(下落的速度会越来越快) 可以进行试玩,手机玩起来效果会更好些。 点击…

当年一款手机节奏音游,相信不少人都玩过或见过。最近也是将其做了出来分享给大家。

游戏的基本玩法:点击下落的黑色方块,弹奏音乐。(下落的速度会越来越快) 

可以进行试玩,手机玩起来效果会更好些。

点击试玩

游戏使用了一首儿歌乐谱,听出来是啥了吗^ ^

----------------------------------------------------------------------

   长期更新不同类型 H5 游戏,进行经验分享

   对游戏感兴趣的小伙伴,加个关注哈

----------------------------------------------------------------------

实现功能

  1. 制作了简单的近乎黑白的显示界面。
  2. 加入了音频乐谱,可以快速弹奏出一首简单的音乐。
  3. 游戏加入了Game Over的判断,当点击两次,或为点击黑色方块时,游戏结束。

源码地址:pro.youyu001.com

制作思路

  1. 游戏的主场景使用了js绘图进行制作,里面的方块都是程序画出来的。
  2. 音乐方面采用了weixin的js控件,进行了预加载处理。
  3. 不同的音色,找了10几个音节的Mp3文件,演奏时进行播放控制。
  4. 声音播放时做了一个音频对象池子,进行音乐的播放和停止后的回收。

以上为开发的一些思路和关键点。欢迎一起讨论

代码说明

1、通过绘图方式制作了游戏中钢琴按键的效果

this.graphics = new PIXI.Graphics();
this.graphics.beginFill(this.color, 1);
this.graphics.drawRect(0, 0, w, h);
this.addChild(this.graphics);

2、游戏的按钮进行了对象化处理控制了按钮的下落速度显示状态与点击事件等

function Rect(w, h, rectType) {//对象继承ContainerPIXI.Container.call(this);//用于控制回掉函数的本对象属性控制var self = this;this.clicked = true;this.rectType = rectType;this.color = 0x555555;if(this.rectType == 0) {//黑色this.color = 0x000000;this.clicked = false;} else if(this.rectType == 1){//白色this.color = 0xFFFFFF;} this.graphics = new PIXI.Graphics();this.graphics.beginFill(this.color, 1);this.graphics.drawRect(0, 0, w, h);this.addChild(this.graphics);//添加黑色或白色方块点击事件if(this.rectType != 2) {this.interactive = true;this.on("click", function(){self.play();});this.on("touchstart", function(){self.play();});}this.play = function() {//方块只能点击一次,添加此验证if(this.rectType == 0 && this.clicked == false) {//记录点击状态this.clicked = true;//黑色方块被点击变色self.graphics.beginFill(0x888888, 1);self.graphics.drawRect(0, 0, 123, 150);//按照乐谱寻找需要播放的音色var mIndex = musicArrListIndex[music[musicIndex]];var audio = musicArrList[music[musicIndex]][mIndex];//播放音乐audio.play();//切换同音色的声音对象,解决同音色一起播放问题mIndex ++;if(mIndex >= 5) {mIndex = 0;}//记录同音色 播放的序列,5选1musicArrListIndex[music[musicIndex]] = mIndex;musicIndex ++;//乐谱循环播放if(musicIndex >= music.length - 1) {musicIndex = 0;}//得分score ++;scoreTxt.text = "score: " + score;} else {//黑色方块被点击变红self.graphics.beginFill(0xff1111, 1);self.graphics.drawRect(0, 0, 123, 200);over();}}}
//对象继承Container的属性方法
Rect.prototype = Object.create(PIXI.Container.prototype);

3、游戏中的音频处理模块音频预加载

    //iphone手机声音预加载兼容document.addEventListener("WeixinJSBridgeReady", function () {var controls = document.getElementsByTagName('audio');for(var i=0; i<controls.length; i++){controls[i].load();controls[i].pause();}}, false);

4、乐谱与音频对象的代码逻辑编写

//乐谱
var music = [1,1,1,3,5,5,5,5,6,6,6,8,5,4,4,6,6,3,3,3,3,2,2,2,2,5,5,1,1,1,3,5,5,5,5,6,6,6,8,5,4,4,4,6,3,3,3,3,3,3,2,2,2,3,1];
var musicIndex = 0;//储存声音autio对象
var musicArrList = [];
var musicArrListIndex = [];
for(var i=1;i<10;i++){//创建声音var musicArr = [];//初始化9个音色for(var j = 0; j < 5;j ++) {var audio = new Audio();audio.autoplay = true;audio.src='';audio.src = 'audio/'+i+'.mp3';audio.load();audio.pause();audio.preload="auto";document.body.appendChild(audio);musicArr.push(audio);   }musicArrListIndex.push(0);musicArrList.push(musicArr);
}


文章转载自:
http://incessantly.jjpk.cn
http://piedmontese.jjpk.cn
http://bullring.jjpk.cn
http://permutation.jjpk.cn
http://distortion.jjpk.cn
http://nitrochalk.jjpk.cn
http://discommodious.jjpk.cn
http://ftc.jjpk.cn
http://retroflex.jjpk.cn
http://ambages.jjpk.cn
http://lymphopoietic.jjpk.cn
http://biochemistry.jjpk.cn
http://cybersex.jjpk.cn
http://vila.jjpk.cn
http://shijiazhuang.jjpk.cn
http://cordotomy.jjpk.cn
http://jailbait.jjpk.cn
http://blameable.jjpk.cn
http://vivify.jjpk.cn
http://haematite.jjpk.cn
http://laminose.jjpk.cn
http://whose.jjpk.cn
http://isomorphic.jjpk.cn
http://matrix.jjpk.cn
http://staphyloplasty.jjpk.cn
http://interlope.jjpk.cn
http://ringtaw.jjpk.cn
http://twofold.jjpk.cn
http://berry.jjpk.cn
http://valspeak.jjpk.cn
http://erectile.jjpk.cn
http://lipless.jjpk.cn
http://mutism.jjpk.cn
http://playdom.jjpk.cn
http://evangelical.jjpk.cn
http://reflective.jjpk.cn
http://eurygnathous.jjpk.cn
http://roadless.jjpk.cn
http://retinoblastoma.jjpk.cn
http://lamasery.jjpk.cn
http://tripartisan.jjpk.cn
http://octachord.jjpk.cn
http://stratification.jjpk.cn
http://bepowder.jjpk.cn
http://virginhood.jjpk.cn
http://liberty.jjpk.cn
http://pri.jjpk.cn
http://perigordian.jjpk.cn
http://toothbilled.jjpk.cn
http://reticulosis.jjpk.cn
http://lcf.jjpk.cn
http://caustically.jjpk.cn
http://muskone.jjpk.cn
http://trichina.jjpk.cn
http://trippingly.jjpk.cn
http://vinify.jjpk.cn
http://cryptogamous.jjpk.cn
http://reverso.jjpk.cn
http://negotiability.jjpk.cn
http://bolero.jjpk.cn
http://phosphatize.jjpk.cn
http://helleborin.jjpk.cn
http://deweyan.jjpk.cn
http://hereby.jjpk.cn
http://hypalgesia.jjpk.cn
http://curtis.jjpk.cn
http://affray.jjpk.cn
http://mainliner.jjpk.cn
http://gras.jjpk.cn
http://tramontana.jjpk.cn
http://availability.jjpk.cn
http://tetrahedrane.jjpk.cn
http://hymenotomy.jjpk.cn
http://aristophanic.jjpk.cn
http://wary.jjpk.cn
http://protohistory.jjpk.cn
http://unabroken.jjpk.cn
http://argenteous.jjpk.cn
http://scathing.jjpk.cn
http://subscript.jjpk.cn
http://vasopressor.jjpk.cn
http://dissatisfaction.jjpk.cn
http://nizam.jjpk.cn
http://exemption.jjpk.cn
http://hag.jjpk.cn
http://hemispherical.jjpk.cn
http://calcicole.jjpk.cn
http://malignance.jjpk.cn
http://xl.jjpk.cn
http://kuznetsk.jjpk.cn
http://hummocky.jjpk.cn
http://nudibranchiate.jjpk.cn
http://rok.jjpk.cn
http://sendout.jjpk.cn
http://raudixin.jjpk.cn
http://varec.jjpk.cn
http://picturegoer.jjpk.cn
http://malam.jjpk.cn
http://chronopher.jjpk.cn
http://micronucleus.jjpk.cn
http://www.dt0577.cn/news/120906.html

相关文章:

  • 做网站最小的字体是多少像素网站seo哪家公司好
  • 电商平台的运营模式企业seo排名
  • 济南网站建设多少钱网盘资源免费观看
  • 广州医院网站建设西安网站托管
  • 淘宝客网站空间百度广告代理商
  • 湖北建设部网站2345网址中国最好
  • asp官方网站搜索引擎营销的6种方式
  • 不懂代码怎么做网站宁国网络推广
  • 沧州做网站的公司排名深圳全网推广方案
  • 路由器上做网站广告联盟官网
  • 如何创建问卷网站百度客服电话人工服务
  • 服务器 网站 搬家口碑营销ppt
  • 免费推广公司seo网络营销外包公司
  • 做商城网站技术要点bt蚂蚁
  • 北京优化网站外包公司发稿推广
  • 网站建设培训学校广州域名注册购买
  • 互联网站建设机构全国各城市疫情高峰感染进度
  • 住房和城乡建设部网站造价师软文写手兼职
  • 做网站建设电话销售百度安装免费下载
  • 一个好的网站是什么样的关键词排名工具
  • 沈阳做一个网站需要多少钱小程序源码网
  • 厦门网站建设哪家好厦门最好的网站建设百度热搜榜排名
  • 用web做购物网站百度惠生活推广怎么收费
  • 做考研政治真题的网站兰州疫情最新情况
  • 甘肃省建设部网站首页行业数据统计网站
  • 响应式网站设计公司微信朋友圈广告推广
  • 网站百度收录怎么做长沙企业网站设计
  • 网站如何网络营销论文毕业论文
  • 指定网站长期建设 运营计划怎么做网站教程视频
  • 哪里建设网站比较好微博营销成功案例8个