Reputation: 2718
I have a problem with no transparent png images in my pygame game.
I load png images and blit them to the screen. I have a dark background of game screen and white background of images. Although, the images blitted are visible with white background. I would expect images to be transparent however I can not achieve it.
I can not find an accurate information in internet with a solution to my problem.
Is there any chance somebody could point me into the right direction and review my game ? How to achieve transparency of images ?
Link to the python code and images: https://www.dropbox.com/s/ng99rqg4ur76msp/game.7z?dl=0
Pictures which shows my problem:
Game background color: black. Image backgroud color: white. How to get the image background transparent so it is not visible regardless the game background color ?
Upvotes: 0
Views: 650
Reputation: 36
I don't understand your question but if your image has a transparent background you just use
image = pygame.image.load("image.png").convert_alpha()
If it has a white background you probably want to set the colorkey like
image = pygame.image.load("image.png").convert()
image.set_colorkey((255,255,255))
Upvotes: 2