Commit b171662d authored by huangwenjie's avatar huangwenjie

1

parent bdd543d4
......@@ -919,7 +919,7 @@ export class PlayScene extends Scene {
// 随机生成基础元素
generateOneElement() {
// 随机生成一个数字 2or4
let randNumber = Math.random() < 0.9 ? 2 : 4
let randNumber = Math.random() < 0.9 ? 2 : 2048
// 随机生成位置
let randNumberX = Math.floor(Math.random() * 4)
let randNumberY = Math.floor(Math.random() * 4)
......@@ -1270,7 +1270,7 @@ export class PlayScene extends Scene {
beforeArr[x][y] = beforeArr[xb][y]
beforeArr[xb][y] = 0
} else if (beforeArr[xb][y] === beforeArr[x][y] && noBlockBottom(x, xb, y, beforeArr)) {
} else if (beforeArr[xb][y] === beforeArr[x][y] && noBlockBottom(x, xb, y, beforeArr) && beforeArr[x][y] < 2048) {
this.containerPool[xb][y].children[0].visible = false
let origin = new GameEle(beforeArr[xb][y])
this.addChild(origin)
......@@ -1317,7 +1317,7 @@ export class PlayScene extends Scene {
beforeArr[x][y] = beforeArr[x][yr]
beforeArr[x][yr] = 0
} else if (beforeArr[x][yr] === beforeArr[x][y] && noBlockRight(x, y, yr, beforeArr)) {
} else if (beforeArr[x][yr] === beforeArr[x][y] && noBlockRight(x, y, yr, beforeArr) && beforeArr[x][y] < 2048) {
this.containerPool[x][yr].children[0].visible = false
let origin = new GameEle(beforeArr[x][yr])
this.addChild(origin)
......@@ -1364,7 +1364,7 @@ export class PlayScene extends Scene {
beforeArr[x][y] = beforeArr[xt][y]
beforeArr[xt][y] = 0
} else if (beforeArr[xt][y] === beforeArr[x][y] && noBlockTop(x, xt, y, beforeArr)) {
} else if (beforeArr[xt][y] === beforeArr[x][y] && noBlockTop(x, xt, y, beforeArr) && beforeArr[x][y] < 2048) {
this.containerPool[xt][y].children[0].visible = false
let origin = new GameEle(beforeArr[xt][y])
this.addChild(origin)
......@@ -1411,7 +1411,7 @@ export class PlayScene extends Scene {
beforeArr[x][y] = beforeArr[x][yl]
beforeArr[x][yl] = 0
} else if (beforeArr[x][yl] === beforeArr[x][y] && noBlockLeft(x, y, yl, beforeArr)) {
} else if (beforeArr[x][yl] === beforeArr[x][y] && noBlockLeft(x, y, yl, beforeArr) && beforeArr[x][y] < 2048) {
this.containerPool[x][yl].children[0].visible = false
let origin = new GameEle(beforeArr[x][yl])
this.addChild(origin)
......@@ -1449,7 +1449,7 @@ export class PlayScene extends Scene {
for (let i = 0; i < arr.length; i++) {
if (arr[i] === 0) {
hasZero = true
} else if (arr[i] !== 0 && hasZero || arr[i] === arr[i + 1]) {
} else if (arr[i] !== 0 && hasZero || (arr[i] === arr[i + 1] && arr[i] < 2048)) {
return true
} else {
continue
......
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