I am working on an Android project using AndEngine. I have a working animated sprite that moves to a touched location on the screen. My issue is I can't seem to figure out how to stop the animation once the sprite reaches the destination. Here is my code for the movement and animation of the sprite. Thanks in advance for any help.
Edit New Code---
@Override
public boolean onSceneTouchEvent (Scene m_Scene, TouchEvent pSceneTouchEvent) {
if (pSceneTouchEvent.getAction() == TouchEvent.ACTION_UP) {
float touchX = pSceneTouchEvent.getX();
float touchY = pSceneTouchEvent.getY();
float[] minerLoc = sprMiner.getSceneCenterCoordinates();
float minerX = minerLoc[0];
float minerY = minerLoc[1];
MoveModifier sprModifier = new MoveModifier(5, minerX, touchX, minerY, touchY)
{
protected void onModifierStarted(IEntity pItem)
{
super.onModifierStarted(sprMiner);
// Start Walking Animation
sprMiner.animate(new long[] {150, 150, 150, 150, 150, 150, 150, 150}, 0, 7, true);
}
protected void onModifierFinished(IEntity pItem)
{
super.onModifierFinished(sprMiner);
//Stop Walking Animation
sprMiner.stopAnimation(0);
}
};
sprMiner.registerEntityModifier(sprModifier);
}
return false;
}