setPosition of Sprite onUpdate in AndEngine
- by SSH This
I am trying to get a "highlighter" circle to follow around a sprite, but I am having trouble, I thought I could use the onUpdate method that's available to me in SequenceEntityModifier but it's not working for me. Here is my code:
// make sequence mod with move modifier
SequenceEntityModifier modifier = new SequenceEntityModifier(myMovemod) {
@Override
protected void onModifierFinished(IEntity pItem) {
// animation finished
super.onModifierFinished(pItem);
}
public float onUpdate(float pSecondsElapsed, IEntity pItem) {
highlighter.setPosition(player2.getX() - highlighterOffset, player2.getY() - highlighterOffset);
return pSecondsElapsed;
}
};
When onUpdate is completely commented out, the sprite moves like I want it to, everything is ok. When I put the onUpdate in, the sprite doesn't move at all. I have a feeling that I am overriding the original onUpdate's actions?
Am I going about this the wrong way? I am new to Java, so please feel free to advise if this isn't going to work.
UPDATE: The player2 is the sprite that I'm trying to get the highlighter to follow.