Game Development Reference
In-Depth Information
Animating the gold coins and bunny head
actors
Add the following (static) import lines to the MenuScreen class:
import static com.badlogic.gdx.scenes.scene2d.actions.Actions.*;
import com.badlogic.gdx.math.Interpolation;
After this, make the following changes to the same class:
private Table buildObjectsLayer () {
Table layer = new Table();
// + Coins
imgCoins = new Image(skinCanyonBunny, "coins");
layer.addActor(imgCoins);
imgCoins.setOrigin(imgCoins.getWidth() / 2,
imgCoins.getHeight() / 2);
imgCoins.addAction(sequence(
moveTo(135, -20),
scaleTo(0, 0),
fadeOut(0),
delay(2.5f),
parallel(moveBy(0, 100, 0.5f, Interpolation.swingOut),
scaleTo(1.0f, 1.0f, 0.25f, Interpolation.linear),
alpha(1.0f, 0.5f))));
// + Bunny
imgBunny = new Image(skinCanyonBunny, "bunny");
layer.addActor(imgBunny);
imgBunny.addAction(sequence(
moveTo(655, 510),
delay(4.0f),
moveBy(-70, -100, 0.5f, Interpolation.fade),
moveBy(-100, -50, 0.5f, Interpolation.fade),
moveBy(-150, -300, 1.0f, Interpolation.elasticIn)));
return layer;
}
 
Search WWH ::




Custom Search