I wanna in andEngine execute a sequence (sprite animation) when sprite collides with something. Tryed to define the sequenceEntityModifier in the IUpdateHandler but the sequence doesn’t execute.
Any suggestion about how to achive this ? Where to put my animation code ?
sprite.registerUpdateHandler(new IUpdateHandler() {
@Override
public void onUpdate(float pSecondsElapsed) {
if(sprite.collidesWith(shape)) {
// this will not work
final SequenceEntityModifier enemyModifier = new SequenceEntityModifier(
...
)
// this too
sprite.setScale(0.5f);
}
}
@Override
public void reset() {
}
});
I guess you are not using Box2D, so register this
IUpdateHandlerto your sprite: