|
|
@@ -110,7 +110,6 @@ Page({ |
|
|
|
}, |
|
|
|
beginGame: function () {//开始游戏 |
|
|
|
app.wxRequest(app.globalData.urlRoot + "dollGame/beginGame", {}, res => { |
|
|
|
console.log(res); |
|
|
|
if(res.code==200){ |
|
|
|
this.data.gameSign = res.data.sign; |
|
|
|
this.endGame(); |
|
|
@@ -137,6 +136,9 @@ Page({ |
|
|
|
}, this,"POST") |
|
|
|
}, |
|
|
|
startClaw:function(e){//开始控制爪子方向 |
|
|
|
if(!this.data.gameState){ |
|
|
|
return; |
|
|
|
} |
|
|
|
let direction = e.currentTarget.dataset.direction; |
|
|
|
if (direction == "L") {//向左 |
|
|
|
if (this.data.clawLeft <= 130) { |
|
|
@@ -188,7 +190,10 @@ Page({ |
|
|
|
}, 20); |
|
|
|
} |
|
|
|
}, |
|
|
|
endClaw:function(e){//结束爪子动作 |
|
|
|
endClaw: function (e) {//结束爪子动作 |
|
|
|
if (!this.data.gameState) { |
|
|
|
return; |
|
|
|
} |
|
|
|
let direction = e.currentTarget.dataset.direction; |
|
|
|
if (direction == "L") {//向左 |
|
|
|
clearInterval(this.data.setGroup.left); |
|
|
@@ -201,6 +206,9 @@ Page({ |
|
|
|
} |
|
|
|
}, |
|
|
|
getClaw:function(){//抓取 |
|
|
|
if (!this.data.gameState){ |
|
|
|
return; |
|
|
|
} |
|
|
|
this.setData({ |
|
|
|
clawTop: this.data.clawScale > 1 ? 490 - (2 * (this.data.clawScale-1) * 90) : 490 + (2 * (1 - this.data.clawScale) * 90 ) |
|
|
|
}) |