QQ资源吧-免费分享全网优质资源

微信小程序怎么制作炸金花?微信小程序制作炸金花的方法

QQ资源吧 微信教程
扫码手机访问
0
      很多朋友喜欢玩炸金花游戏,那么怎么在微信小程序上制作炸金花呢?下面就是QQ资源吧www.qqzy8.com带来的完整详细的教程,想要学习的小伙伴就赶紧看过来吧。
微信小号怎么申请? 同一手机号可注册辅助账号
      微信小程序怎么制作炸金花?微信小程序制作炸金花的方法

      app.json:

      {

      "pages":[

      "pages/index/index"

      ],

      "window":{

      "navigationBarBackgroundColor": "#333333","navigationBarTextStyle":"white",

      "navigationBarTitleText": "炸金花",

      "backgroundColor":"#ffffff",

      "backgroundTextStyle":"light",

      "enablePullDownRefresh":false

      }

      }

      index.js

      Page({

      data:{

      num1:1,

      num2:2,

      num3:3,

      imgNum1:1,

      imgNum2:2,

      imgNum3:3,

      b1:"white",

      b2:"white",

      b3:"white",

      flag:true,

      butype:"primary",

      butext:"开始",

      hidden:true,

      score:0

      },

      start:function(){

      var that=this;

      that.setData({

      butype:"default",

      butext:"停止"

      })

      if(this.data.flag){

      this.go=setInterval(function(){

      that.setData({

      num1:Math.ceil(Math.random()*10),

      num2:Math.ceil(Math.random()*10),

      num3:Math.ceil(Math.random()*10),

      imgNum1:Math.ceil(Math.random()*4),

      imgNum2:Math.ceil(Math.random()*4),

      imgNum3:Math.ceil(Math.random()*4),

      b1:"#"+Math.floor(Math.random()*1000000),b2:"#"+Math.floor(Math.random()*1000000),b3:"#"+Math.floor(Math.random()*1000000)

      })

      },100)

      this.setData({

      flag:false,

      hidden:true,

      score:0

      })

      }else{

      clearInterval(this.go)

      this.setData({

      flag:true,

      butype:"primary",

      butext:"开始",

      b1:"white",

      b2:"white",

      b3:"white"

      })

      var n1=this.data.num1;

      var n2=this.data.num2;

      var n3=this.data.num3;

      var img1=this.data.imgNum1;

      var img2=this.data.imgNum2;

      var img3=this.data.imgNum3;

      var result=n1+n2+n3;

      if(img1==img2&&img2==img3){

      result+=20;

      }else if(img1==img2 || img2==img3 || img1==img3){result+=10;

      }

      var newarr=new Array();

      newarr.push(n1)

      newarr.push(n2)

      newarr.push(n3)

      for(var i=0;i

      for(var j = i + 1;j

      if(newarr[i]>newarr[j]){

      var tmp = newarr[i];

      newarr[i] = newarr[j];

      newarr[j] = tmp;

      }

      }

      }

      if(((newarr[2]-newarr[1])==1)&&((newarr[1]-newarr[0])==1)){result+=30;

      }else if(newarr[2]==newarr[1] || newarr[2]==newarr[0] || newarr[0]==newarr[1]){result+=10;

      }else if(newarr[2]==newarr[1]&&newarr[2]==newarr[0]){result+=40;

      }

      this.setData({

      hidden:false,

      score:result

      })

      }

      },

      onShareAppMessage: function () {

      return {

      title: "大小之争",

      desc: '激烈的竞技游戏',

      path: '/pages/index/index'

      }

      }

      })

      ndex.wxml:

      恭喜你得了{{score}}分!

      {{num1}}

      {{num1}}

      {{num2}}

      {{num2}}

      {{num3}}

      {{num3}}

      {{butext}}

      1.如果三张数字相同得40分,如果三张数字是连续的得30分,如果两个数字是相同的得10分

      2.如果三张花色一样得20分,如果两张花色一样得10分

      3.三张数字之和

      以上所有数字的总和为总分

      index.wxss:

      .container{width:30%;height:200px;position:relative;border:1px solid #787775;box-sizing:border-box; display: inline-block;flex:1;margin:10px;border-radius:10px;box-shadow:

      5px 5px 3px #787775}

      .text{width:30px;height:30px;position:absolute;top:15px;left:15px;font-size: 25px;font-weight: bolder}

      .img{width:50px;height:50px;position:absolute;top:50%;left:50%;margin-left:-25px;margin-top:-25px}

      .text1{width:30px;height:30px;position:absolute;bottom:15px;right:15px;font-size: 25px;font-weight: bolder;transform: rotate(180deg)}

      以上就是QQ资源吧www.qqzy8.com分享的微信小程序制作炸金花的方法,感兴趣的朋友可以来看看哦。
  您阅读这篇文章共花了: 

标签:

暂无标签

免责声明:

本站提供的资源,都来自网络,版权争议与本站无关,所有内容及软件的文章仅限用于学习和研究目的。不得将上述内容用于商业或者非法用途,否则,一切后果请用户自负,我们不保证内容的长久可用性,通过使用本站内容随之而来的风险与本站无关,您必须在下载后的24个小时之内,从您的电脑/手机中彻底删除上述内容。如果您喜欢该程序,请支持正版软件,购买注册,得到更好的正版服务。侵删请致信E-mail: 487528908@qq.com

同类推荐
评论列表

相关通知:

如发现本站有侵权违规的相关内容请致信E-mail: 487528908@qq.com

富强民主文明和谐自由平等公正法制丨爱国敬业诚信友善
协助本站优化一下
百度一下
关键词不能为空
当前时间
热门文章
随机推荐
微信教程 微信小程序怎么制作炸金花?微信小程序制作炸金花的方法
      很多朋友喜欢玩炸金花游戏,那么怎么在微信小程序上制作炸金花呢?下面就是QQ资源吧www.qqzy8.com带来的完整详...
扫描二维码阅读原文
QQ资源吧 January, 01
生成社交图 ×