Commit a4a9ea8b authored by huangwenjie's avatar huangwenjie

1

parent 1a1c751b
export const noBlockLeft = (x, y, yl, beforeArr) => {
if (y > yl + 1) {
for (let t = yl - 1; t < y; t++) {
if (beforeArr[x][y] !== 0) {
return false
}
}
}
if (y < yl + 1) {
for (let t = y - 1; t < yl; t++) {
if (beforeArr[x][y] !== 0) {
return false
}
}
}
return true
}
export const noBlockRight = (x, y, yr, beforeArr) => {
if (yr > y + 1) {
for (let t = y - 1; t < yr; t++) {
if (beforeArr[x][y] !== 0) {
return false
}
}
}
if (yr < y + 1) {
for (let t = yr - 1; t < y; t++) {
if (beforeArr[x][y] !== 0) {
return false
}
}
}
return true
}
export const noBlockTop = (x, xt, y, beforeArr) => {
if (x > xt + 1) {
for (let t = xt - 1; t < x; t++) {
if (beforeArr[x][y] !== 0) {
return false
}
}
}
if (x < xt + 1) {
for (let t = x - 1; t < xt; t++) {
if (beforeArr[x][y] !== 0) {
return false
}
}
}
return true
}
export const noBlockBottom = (x, xb, y, beforeArr) => {
if (xb > x + 1) {
for (let t = x - 1; t < xb; t++) {
if (beforeArr[x][y] !== 0) {
return false
}
}
}
if (xb < x + 1) {
for (let t = x - 1; t < xb; t++) {
if (beforeArr[x][y] !== 0) {
return false
}
}
}
return true
}
\ No newline at end of file
...@@ -17,55 +17,58 @@ export class GameEle extends Sprite { ...@@ -17,55 +17,58 @@ export class GameEle extends Sprite {
switch (eleType + "") { switch (eleType + "") {
case "2": case "2":
this.texture = RES.getRes("ele2.png") this.texture = RES.getRes("ele2.png")
this.x = 5 this.x = 10
this.y = -5 this.y = 20
break break
case "4": case "4":
this.texture = RES.getRes("ele4.png") this.texture = RES.getRes("ele4.png")
this.x = -10 this.x = -2
this.y = -5 this.y = 20
break break
case "8": case "8":
this.texture = RES.getRes("ele8.png") this.texture = RES.getRes("ele8.png")
this.y = -5 this.x = 5
this.y = 20
break break
case "16": case "16":
this.texture = RES.getRes("ele16.png") this.texture = RES.getRes("ele16.png")
this.x = 5 this.x = 12
this.y = -15 this.y = 15
break break
case "32": case "32":
this.texture = RES.getRes("ele32.png") this.texture = RES.getRes("ele32.png")
this.y = -10 this.x = 8
this.y = 20
break break
case "64": case "64":
this.texture = RES.getRes("ele64.png") this.texture = RES.getRes("ele64.png")
this.y = -15 this.x = 8
this.y = 16
break break
case "128": case "128":
this.texture = RES.getRes("ele128.png") this.texture = RES.getRes("ele128.png")
this.x = 5 this.x = 8
this.y = -10 this.y = 20
break break
case "256": case "256":
this.texture = RES.getRes("ele256.png") this.texture = RES.getRes("ele256.png")
this.x = 5 this.x = 8
this.y = -10 this.y = 20
break break
case "512": case "512":
this.texture = RES.getRes("ele512.png") this.texture = RES.getRes("ele512.png")
this.x = 5 this.x = 8
this.y = -10 this.y = 20
break break
case "1024": case "1024":
this.texture = RES.getRes("ele1024.png") this.texture = RES.getRes("ele1024.png")
this.x = 10 this.x = 10
this.y = -10 this.y = 20
break break
case "2048": case "2048":
this.texture = RES.getRes("ele2048.png") this.texture = RES.getRes("ele2048.png")
this.x = 5 this.x = 8
this.y = -10 this.y = 20
break break
default: default:
this.texture = Texture.EMPTY this.texture = Texture.EMPTY
......
This diff is collapsed.
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