Commit 6c9718fa by Matt

fix hit test

parent faa48ffb
...@@ -34,7 +34,7 @@ class Map extends egret.Sprite { ...@@ -34,7 +34,7 @@ class Map extends egret.Sprite {
Store.getState().runners.forEach(runnerData => { Store.getState().runners.forEach(runnerData => {
const runner = new Runner(runnerData) const runner = new Runner(runnerData)
if (Store.isCatcher()) { if (Store.isCatcher()) {
runner.alpha === 0 runner.alpha = 0
} }
this.addChild(runner) this.addChild(runner)
this.runnerMap[runnerData.t_cid] = runner this.runnerMap[runnerData.t_cid] = runner
...@@ -102,12 +102,11 @@ class Map extends egret.Sprite { ...@@ -102,12 +102,11 @@ class Map extends egret.Sprite {
grid.alpha = 1 grid.alpha = 1
}) })
runners.forEach(runner => { runners.forEach(runner => {
console.log(this.touchArea.hitTestPoint(runner.x, runner.y), runner)
if (this.touchArea.hitTestPoint(runner.x * gridWidth, runner.y * gridHeight)) { if (this.touchArea.hitTestPoint(runner.x * gridWidth, runner.y * gridHeight)) {
runner.alpha = 1 runner.alpha = 1
} }
}) })
this.getCatchedRunners().forEach(runner => { this.getCatchedRunners(x, y).forEach(runner => {
platform.sendSocketMessage({ platform.sendSocketMessage({
data: JSON.stringify({ data: JSON.stringify({
type: 'catch', type: 'catch',
...@@ -115,8 +114,8 @@ class Map extends egret.Sprite { ...@@ -115,8 +114,8 @@ class Map extends egret.Sprite {
cid: Store.getState().cid, cid: Store.getState().cid,
payload: { payload: {
mark: runner.mark, mark: runner.mark,
x, x: x / gridWidth,
y, y: y / gridHeight,
t_cid: runner.t_cid t_cid: runner.t_cid
} }
}), }),
......
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