fixed 一次碰撞判断异常修复
This commit is contained in:
parent
594130498c
commit
6831f11b28
4
index.js
4
index.js
@ -116,6 +116,7 @@
|
|||||||
var stage = this;
|
var stage = this;
|
||||||
if(stage.status==1){ //场景正常运行
|
if(stage.status==1){ //场景正常运行
|
||||||
items.forEach(function(item){
|
items.forEach(function(item){
|
||||||
|
if(map&&!map.get(item.coord.x,item.coord.y)&&!map.get(player.coord.x,player.coord.y)){
|
||||||
var dx = item.x-player.x;
|
var dx = item.x-player.x;
|
||||||
var dy = item.y-player.y;
|
var dy = item.y-player.y;
|
||||||
if(dx*dx+dy*dy<750&&item.status!=4){ //物体检测
|
if(dx*dx+dy*dy<750&&item.status!=4){ //物体检测
|
||||||
@ -127,11 +128,12 @@
|
|||||||
stage.timeout = 30;
|
stage.timeout = 30;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
}
|
||||||
});
|
});
|
||||||
if(JSON.stringify(beans.data).indexOf(0)<0){ //当没有物品的时候,进入结束画面
|
if(JSON.stringify(beans.data).indexOf(0)<0){ //当没有物品的时候,进入结束画面
|
||||||
game.nextStage();
|
game.nextStage();
|
||||||
}
|
}
|
||||||
}else if(stage.status==3){ //场景暂停状态
|
}else if(stage.status==3){ //场景临时状态
|
||||||
if(!stage.timeout){
|
if(!stage.timeout){
|
||||||
_LIFE--;
|
_LIFE--;
|
||||||
if(_LIFE){
|
if(_LIFE){
|
||||||
|
Loading…
x
Reference in New Issue
Block a user