In my game,I have array of coins appearing on a particular action.Once I touch the coins,coins have to move off smoothly(like flying) to one corner of the screen,one by one. I am creating and drawing coin array like this:
private Coin coins[] = new Coin[10];//coin array
for(int i=0;i<coins.length;i++) {
coins[i]=objectFactory.createCoin();//creating object array of coins
}
draw coins
for(int i=0;i<coins.length;i++) {
coinTexture = coinAnimation.getKeyFrame(animationTime, true);
batch.draw(coinTexture,coins[i].getX(), coins[i].getY());
}
for detecting touch on coin:
if(Gdx.input.isTouched()) {
Vector3 touchPos = new Vector3();
touchPos.set(Gdx.input.getX(), Gdx.input.getY(), 0);
game.camera.unproject(touchPos);
for(int i=0;i<coins.length;i++){
Rectangle textureBounds=new Rectangle(coins[i].getX(),coins[i].getY(),coins[i].getWidth(),coins[i].getHeight());
if(textureBounds.contains(touchPos.x,touchPos.y)) {
System.out.println("u touched the coin!!!!!!!!");
}
}
}
I now want to use Universal TweenEngine to tween it on touch to the corner of the screen.I am completely new to the concept of tween engine. I am not able to find any helpful documentation on how to achieve this affect with tween engine.Any help would be appreciated.