Quantcast
Channel: Question and Answer » libgdx
Viewing all articles
Browse latest Browse all 434

Fading in and fading out animations

$
0
0

This is how I’m creating my player. Is there any way to start fading in and fading out for an amount of time when I get hit?

private Texture tex = Game.res.getTexture("player");

public Player(Body body) {
   TextureRegion[] sprites = new TextureRegion[1];
   sprites[0] = new TextureRegion(tex, 0, 0, 70, 96);
   sprites[1] = new TextureRegion(tex, 69, 193, 68, 93);
   animation.setFrames(sprites, 1 / 6f);
}

Viewing all articles
Browse latest Browse all 434

Trending Articles