Commit 45bb3d75 authored by AU-Pro-mac's avatar AU-Pro-mac

fixed game bugs

parent 03e1853f
...@@ -2969,7 +2969,7 @@ var GoodsContainer = (function (_super) { ...@@ -2969,7 +2969,7 @@ var GoodsContainer = (function (_super) {
_this.goodsArr = []; _this.goodsArr = [];
_this.createGoodTimeOut = false; _this.createGoodTimeOut = false;
_this.intoGoods = []; _this.intoGoods = [];
_this.gameEndFlag = false; _this.gameEndFlag = 0;
_this.speed = 2.5; _this.speed = 2.5;
_this.acceleratedSpeed = 0.01; _this.acceleratedSpeed = 0.01;
_this.lt = 0; _this.lt = 0;
...@@ -3058,7 +3058,13 @@ var GoodsContainer = (function (_super) { ...@@ -3058,7 +3058,13 @@ var GoodsContainer = (function (_super) {
g.turnDirection(direction); g.turnDirection(direction);
if (g.dir !== direction) { if (g.dir !== direction) {
if (g.wrong === 'endGame') { if (g.wrong === 'endGame') {
g.turnDirection(direction, 'gameOver'); this.gameEndFlag += 1;
if (this.gameEndFlag > 1) {
g.turnDirection(direction);
}
else {
g.turnDirection(direction, 'gameOver');
}
} }
else { else {
this._root.gameScoreChange(g.wrong); this._root.gameScoreChange(g.wrong);
...@@ -3110,7 +3116,7 @@ var GoodsContainer = (function (_super) { ...@@ -3110,7 +3116,7 @@ var GoodsContainer = (function (_super) {
this.goodsContainer = null; this.goodsContainer = null;
}; };
GoodsContainer.prototype.startGoods = function () { GoodsContainer.prototype.startGoods = function () {
this.gameEndFlag = false; this.gameEndFlag = 0;
this.createGoodTimeOut = true; this.createGoodTimeOut = true;
}; };
GoodsContainer.prototype.createGoods = function () { GoodsContainer.prototype.createGoods = function () {
...@@ -3156,9 +3162,6 @@ var GoodsContainer = (function (_super) { ...@@ -3156,9 +3162,6 @@ var GoodsContainer = (function (_super) {
}, 750) }, 750)
.call(function () { .call(function () {
if (cb === 'gameOver') { if (cb === 'gameOver') {
if (_this.gameEndFlag)
return;
_this.gameEndFlag = true;
_this.removeAllGoods(); _this.removeAllGoods();
_this._root.gameOver(); _this._root.gameOver();
} }
...@@ -3180,9 +3183,6 @@ var GoodsContainer = (function (_super) { ...@@ -3180,9 +3183,6 @@ var GoodsContainer = (function (_super) {
}, 750) }, 750)
.call(function () { .call(function () {
if (cb === 'gameOver') { if (cb === 'gameOver') {
if (_this.gameEndFlag)
return;
_this.gameEndFlag = true;
_this.removeAllGoods(); _this.removeAllGoods();
_this._root.gameOver(); _this._root.gameOver();
} }
......
This source diff could not be displayed because it is too large. You can view the blob instead.
...@@ -2971,7 +2971,7 @@ var GoodsContainer = (function (_super) { ...@@ -2971,7 +2971,7 @@ var GoodsContainer = (function (_super) {
_this.goodsArr = []; _this.goodsArr = [];
_this.createGoodTimeOut = false; _this.createGoodTimeOut = false;
_this.intoGoods = []; _this.intoGoods = [];
_this.gameEndFlag = false; _this.gameEndFlag = 0;
_this.speed = 2.5; _this.speed = 2.5;
_this.acceleratedSpeed = 0.01; _this.acceleratedSpeed = 0.01;
_this.lt = 0; _this.lt = 0;
...@@ -3060,7 +3060,13 @@ var GoodsContainer = (function (_super) { ...@@ -3060,7 +3060,13 @@ var GoodsContainer = (function (_super) {
g.turnDirection(direction); g.turnDirection(direction);
if (g.dir !== direction) { if (g.dir !== direction) {
if (g.wrong === 'endGame') { if (g.wrong === 'endGame') {
g.turnDirection(direction, 'gameOver'); this.gameEndFlag += 1;
if (this.gameEndFlag > 1) {
g.turnDirection(direction);
}
else {
g.turnDirection(direction, 'gameOver');
}
} }
else { else {
this._root.gameScoreChange(g.wrong); this._root.gameScoreChange(g.wrong);
...@@ -3112,7 +3118,7 @@ var GoodsContainer = (function (_super) { ...@@ -3112,7 +3118,7 @@ var GoodsContainer = (function (_super) {
this.goodsContainer = null; this.goodsContainer = null;
}; };
GoodsContainer.prototype.startGoods = function () { GoodsContainer.prototype.startGoods = function () {
this.gameEndFlag = false; this.gameEndFlag = 0;
this.createGoodTimeOut = true; this.createGoodTimeOut = true;
}; };
GoodsContainer.prototype.createGoods = function () { GoodsContainer.prototype.createGoods = function () {
...@@ -3158,9 +3164,6 @@ var GoodsContainer = (function (_super) { ...@@ -3158,9 +3164,6 @@ var GoodsContainer = (function (_super) {
}, 750) }, 750)
.call(function () { .call(function () {
if (cb === 'gameOver') { if (cb === 'gameOver') {
if (_this.gameEndFlag)
return;
_this.gameEndFlag = true;
_this.removeAllGoods(); _this.removeAllGoods();
_this._root.gameOver(); _this._root.gameOver();
} }
...@@ -3182,9 +3185,6 @@ var GoodsContainer = (function (_super) { ...@@ -3182,9 +3185,6 @@ var GoodsContainer = (function (_super) {
}, 750) }, 750)
.call(function () { .call(function () {
if (cb === 'gameOver') { if (cb === 'gameOver') {
if (_this.gameEndFlag)
return;
_this.gameEndFlag = true;
_this.removeAllGoods(); _this.removeAllGoods();
_this._root.gameOver(); _this._root.gameOver();
} }
......
...@@ -32,7 +32,7 @@ export default class GoodsContainer extends FYGE.Container { ...@@ -32,7 +32,7 @@ export default class GoodsContainer extends FYGE.Container {
// 进入可被滑动的 掉落物 // 进入可被滑动的 掉落物
intoGoods = []; intoGoods = [];
// 游戏结束 flag // 游戏结束 flag
gameEndFlag = false; gameEndFlag = 0;
private speed = 2.5 // 初速度 private speed = 2.5 // 初速度
private acceleratedSpeed = 0.01 // 加速度 private acceleratedSpeed = 0.01 // 加速度
...@@ -136,7 +136,12 @@ export default class GoodsContainer extends FYGE.Container { ...@@ -136,7 +136,12 @@ export default class GoodsContainer extends FYGE.Container {
g.turnDirection(direction) g.turnDirection(direction)
if (g.dir !== direction) { if (g.dir !== direction) {
if (g.wrong === 'endGame') { if (g.wrong === 'endGame') {
g.turnDirection(direction, 'gameOver') this.gameEndFlag += 1
if (this.gameEndFlag > 1) {
g.turnDirection(direction)
} else {
g.turnDirection(direction, 'gameOver')
}
} else { } else {
this._root.gameScoreChange(g.wrong) this._root.gameScoreChange(g.wrong)
this.floatScore(direction, g.wrong) this.floatScore(direction, g.wrong)
...@@ -197,7 +202,7 @@ export default class GoodsContainer extends FYGE.Container { ...@@ -197,7 +202,7 @@ export default class GoodsContainer extends FYGE.Container {
// 掉落物开始掉落 // 掉落物开始掉落
startGoods () { startGoods () {
this.gameEndFlag = false this.gameEndFlag = 0
this.createGoodTimeOut = true this.createGoodTimeOut = true
} }
...@@ -245,8 +250,6 @@ export default class GoodsContainer extends FYGE.Container { ...@@ -245,8 +250,6 @@ export default class GoodsContainer extends FYGE.Container {
}, 750) }, 750)
.call(() => { .call(() => {
if (cb === 'gameOver') { if (cb === 'gameOver') {
if (this.gameEndFlag) return
this.gameEndFlag = true
this.removeAllGoods() this.removeAllGoods()
this._root.gameOver() this._root.gameOver()
} }
...@@ -269,8 +272,6 @@ export default class GoodsContainer extends FYGE.Container { ...@@ -269,8 +272,6 @@ export default class GoodsContainer extends FYGE.Container {
}, 750) }, 750)
.call(() => { .call(() => {
if (cb === 'gameOver') { if (cb === 'gameOver') {
if (this.gameEndFlag) return
this.gameEndFlag = true
this.removeAllGoods() this.removeAllGoods()
this._root.gameOver() this._root.gameOver()
} }
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment