优化机器人移动

This commit is contained in:
aozhiwei 2019-09-19 14:40:55 +08:00
parent ccdb5db5c4
commit d2b68f3fea

View File

@ -99,10 +99,10 @@ void AndroidAI::DoMove()
for (int i = 0; i < speed; ++i) { for (int i = 0; i < speed; ++i) {
a8::Vec2 old_pos = hum->pos; a8::Vec2 old_pos = hum->pos;
hum->pos = hum->pos + hum->move_dir; hum->pos = hum->pos + hum->move_dir;
if (hum->IsCollision()) { if (hum->IsCollisionInMapService()) {
hum->pos = old_pos; hum->pos = old_pos;
if (i == 0) { if (i == 0) {
hum->FindPath(); hum->FindPathInMapService();
} }
break; break;
} }