I'm trying put a LoopEntityModifier for a sprite to have continuous forward backward movement
But something is wrong with that.
Movement is not smooth.
I guess i'm making mistake on reseting loop.
How can i make smooth movement out of it.
LoopEntityModifier looper = new LoopEntityModifier (
new IEntityModifierListener(){
public void onModifierStarted(
IModifier<IEntity> pModifier, IEntity pItem) {
// TODO Auto-generated method stub
Log.d("Modifier","Modifier Started !!");
}
public void onModifierFinished(
IModifier<IEntity> pModifier, IEntity pItem) {
// TODO Auto-generated method stub
Log.d("Modifier","Modifier Finished !!");
pModifier.reset();
}
},
1,
new ILoopEntityModifierListener(){
public void onLoopStarted(
LoopModifier<IEntity> pLoopModifier, int pLoop,
int pLoopCount) {
// TODO Auto-generated method stub
Log.d("Modifier","Loop Started !!");
}
public void onLoopFinished(
LoopModifier<IEntity> pLoopModifier, int pLoop,
int pLoopCount) {
// TODO Auto-generated method stub
Log.d("Modifier","Loop Finished !!");
}
},
new SequenceEntityModifier(
//Forward
new MoveXModifier(.5f,mNextSprite.getX(),mNextSprite.getX()+50),
//Backward
new MoveXModifier(.5f,mNextSprite.getX(),mNextSprite.getX()-50))
);
mNextSprite.registerEntityModifier(looper);