Search code examples
androidtransparencyspritegame-development

How do I make the background of a sprite transparent on Android?


I'm developing a game for Android. For the purpose of this question let's assume that I have a sprite of a red ball moving in space over some background or whatever.

I have a PNG file which I use to draw my background and a PNG file which I use to draw my ball over the background. The problem is my ball is a red circle on a 20 X 20 pixels PNG, meaning I have some white 'left over', so when I draw it on the screen, the 'white left over' appears over my background when I only want the red circle to.

I'm sorry but I'm totally new to animation. How do I crop my circle out of my square PNG or otherwise make the background in my ball PNG transparent? Do I do it programmatically or is there a way to paint my PNG so the non-relevant part is transparent?


Solution

  • Programs like Photoshop and GIMP allow you to set the background as transparent instead of white. Try editing your PNG in one of these and removing the white.