AndEngine。我在游戏中使用Path()和PathModifier()。
path = new Path(2).to(10, 10).to(100, 100);
sprite.registerEntityModifier(new LoopEntityModifier(new PathModifier(1f, path, null, new IPathModifierListener() {
public void onPathStarted(final PathModifier pPathModifier, final IEntity pEntity) {
}
public void onPathWaypointStarted(final PathModifier pPathModifier, final IEntity pEntity, final int pWaypointIndex) {
}
public void onPathWaypointFinished(final PathModifier pPathModifier, final IEntity pEntity, final int pWaypointIndex) {
}
public void onPathFinished(final PathModifier pPathModifier, final IEntity pEntity) {
}
}, EaseSineInOut.getInstance())));
它有效,但我不想要无限循环。然后我改变了方法onPathFinished():
public void onPathFinished(final PathModifier pPathModifier, final IEntity pEntity) {
pEntity.clearEntityModifiers();
}
但之后我的精灵完成了1次循环并返回第一个位置(10,10)并停止。 那么,如何在1循环后停止位置(100,100)?
答案 0 :(得分:3)
您应该在yourSprite.setPosition(100,100)
onPathFinished()