Commit ad398fb5 by Matt

fix hit test

parent 6c9718fa
......@@ -81,8 +81,9 @@ class Map extends egret.Sprite {
public getCatchedRunners(x, y) {
const catchedRunners = []
Store.getState().runners.forEach(runner => {
if (runner.x === x && runner.y === y) {
catchedRunners.push(runner)
const updatedRunner = this.runnerMap[runner.t_cid]
if (updatedRunner.x === x && updatedRunner.y === y) {
catchedRunners.push(updatedRunner)
}
})
return catchedRunners
......@@ -103,7 +104,7 @@ class Map extends egret.Sprite {
})
runners.forEach(runner => {
if (this.touchArea.hitTestPoint(runner.x * gridWidth, runner.y * gridHeight)) {
runner.alpha = 1
this.runnerMap[runner.t_cid].alpha = 1
}
})
this.getCatchedRunners(x, y).forEach(runner => {
......@@ -130,7 +131,7 @@ class Map extends egret.Sprite {
grid.alpha = 0
})
runners.forEach(runner => {
runner.alpha = 0
this.runnerMap[runner.t_cid].alpha = 0
})
this.touchArea.alpha = 0
this.isShowingTouchArea = false
......
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