onPathFinished() {} を使用して、前のパスが終了した後に新しいパスを作成できます。あまり良い選択ではないかもしれませんが、私にとってはうまくいきます。
私はいくつかのコードを書きました:
function go() {
HashMap<float, float> coords = calcNewCoords();
path = new Path(2).to(currentPosX, currentPosY).to(coords.get("toX"),coords.get("yoY"));
time = calcTime();
petSprite.registerEntityModifier(new PathModifier(time,
path, null, new IPathModifierListener() {
@Override
public void onPathWaypointFinished(PathModifier pPathModifier,
IEntity pEntity, int pWaypointIndex) {
// TODO Auto-generated method stub
rest();
}
}));
}
function rest() {
....
go();
}
そのようなもの...それは私の本当のコードではありません..しかし、私は onPathWaypointFinished() を試してみましたが、うまくいきました!!!! 私のゲームには、休んで別のポイントに行くよりも、ランダムな側からランダムな位置まで歩くキャラクターがいます...