I'm using Tween Engine in my LibGDX project, and was wondering if there is a way of animating the position of sprites randomly and loop it, or check if a tween animation is over?
The solution i found at my problem is by creating a method like this:
public void tweenSprite(float x, float y, float currX, float currY){
Tween.set(sprite, SpriteAccessor.POSXY).target(currX, currY).start(tweenManager);
Tween.to(sprite, SpriteAccessor.POSXY, 5 + r.nextInt(5)).target(x, -y).setCallback(new TweenCallback(){
@Override
public void onEvent(int arg0, BaseTween<?> arg1) {
tweenSprite(r.nextInt(60), r.nextInt(60), sprite.getX(), sprite.getY());
}
}).start(tweenManager);
}