Commit 5e301ee7 by Matt

catched tip

parent 5add77ce
......@@ -8,6 +8,7 @@ class Map extends egret.Sprite {
public isShowingTouchArea
private runnerMap:any = {}
private runnerList:any = []
private catchedTip: egret.Bitmap = new egret.Bitmap()
public constructor() {
super();
this.init()
......@@ -52,6 +53,10 @@ class Map extends egret.Sprite {
this.showClickedGrid(x, y)
}
})
this.catchedTip.texture = RES.getRes('catched_jpg')
this.catchedTip.alpha = 0
this.addChild(this.catchedTip)
}
public getSurroundedGrids(x, y) {
......@@ -81,8 +86,8 @@ class Map extends egret.Sprite {
public getCatchedRunners(x, y) {
const catchedRunners = []
Store.getState().runners.forEach(runner => {
const updatedRunner = this.runnerMap[runner.t_cid]
if (updatedRunner.x === x && updatedRunner.y === y) {
const runnerInMap = this.runnerMap[runner.t_cid]
if (runnerInMap.x === x && runnerInMap.y === y) {
catchedRunners.push(runner)
}
})
......@@ -118,7 +123,8 @@ class Map extends egret.Sprite {
runnerInMap.alpha = 1
}
})
this.getCatchedRunners(x, y).forEach(runner => {
const catchedRunners = this.getCatchedRunners(x, y)
catchedRunners.forEach(runner => {
platform.sendSocketMessage({
data: JSON.stringify({
......@@ -135,12 +141,15 @@ class Map extends egret.Sprite {
})
if (Store.isMe(runner.t_cid) || Store.isCatcher()) {
SoundManager.getInstance().playCatched()
const tween = egret.Tween.get(this.catchedTip);
tween.to({alpha: 1}, 300).wait(500).to({alpha: 0}, 300)
}
if (Store.isCatcher()) {
this.runnerMap[runner.t_cid].alpha = 0
}
})
setTimeout(() => {
centerGrid.bg.texture = RES.getRes('grid_jpg')
surroundedGrids.forEach(grid => {
......
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