We are programming a game in Android with libgdx. It's a Doodle Jump like.
At a point of the game, we want plateforms to disapear step by step by reducing the transparency of the picture. We've tested many things but nothing works.
batch.begin();
batch.draw(picture, posX, posY, width, heigth);
bach.end();
We also tried with this, but it doesn't work :
batch.setColor(1, 0, 0, 1);
SpriteBatch#setColor works: you didnt change the alpha (last value), thats why it didnt work for you.
batch.begin();
batch.setColor(1, 1, 1, 0.5F); //0.5F is the alpha value that you want (0-1)
batch.draw(picture, posX, posY, width, heigth);
batch.setColor(1, 1, 1, 1); //change it back to full opacity white, for the other objects to render correctly
bach.end();
If you start using Sprites, mrzli answer is the way to go.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With