TiledMap 地图碰撞检测精度问题

做迷宫游戏时,tiledMap分两个层,第一层是显示层,第二层是障碍物层,覆盖在第一层上,不可见。然后在代码中,我创建一个精灵,这精灵移动遇到障碍物,时而可以穿过,时而不可以穿过。

checkCollisionAndExits: function (key){
this.posX = this.sprite.getPositionX();
this.posY = this.sprite.getPositionY();
var p = cc.p(this.posX, this.posY);
setX = this.offsetX ;//差值平衡
//var p = cc.p(this.posX, this.posY);
var pos = this.convertTotileCoord§;
this.tileGid = this.meta.getTileGIDAt(pos);
this.exitsGid = this.exits.getTileGIDAt(pos);
this.routeGid = this.route.getTileGIDAt(pos);
if (this.routeGid > 0) {
this.checkWrongRoute(pos);
}
if (this.tileGid > 0 || this.exitsGid > 0) {
if (this.tileGid > 0) {//碰撞检测
this.checkCollision();
}
else {//出口检测
if (this.exitsGid != 33)
this.checkExits();
}
}
else {//向右行走
this.addPersonMove(key);
this.sprite.setPosition(this.posX + this.step, this.posY);
}

}
//这个是转换成瓦片地图的坐标
convertTotileCoord: function (pos) {
var x = (pos.x + setX) / this.tiledMap.getContentSize().width * this.tiledMap.getMapSize().width;
var y = this.tiledMap.getMapSize().height - (pos.y + setY) / this.tiledMap.getContentSize().height * this.tiledMap.getMapSize().height;
return cc.p(parseInt(x), parseInt(y));

},

像下面这样移动的情况,小人可以穿过去,求大神指导下解决下。谢谢

你的这个行走是走格子的方式吗?

请问楼主小人走格子,除了走格子的方式还有能不能一次性走好几格,让行走的感觉效果好点