微信小程序 扎金花
实现效果图:
app.json:
index.js:
})
}else{
clearInterval(this.go)
this.setData({
flag:true,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<newarr.length;i++){
for(var j = i + 1;j<newarr.length;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'
}
}
})
index.wxml:
<view class="container" style="background:{{b2}};">
<text class="text">{{num2}}
<image class="img" src="../../images/{{imgNum2}}.png" style="transform: rotate({{deg2}}deg)">
<text class="text1">{{num2}}
<button bindtap="start" type="{{butype}}" style="margin:20px">{{butext}}
<view style="font-size:13px;padding:20px;color:gray">
index.wxss:
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)}
1.png:
2.png:
3.png
4.png
感谢阅读,希望能帮助到大家,谢谢大家对本站的支持!
原文链接:https://www.f2er.com/weapp/41417.html