The following code loads a picture which supposedly has transparent background. However, the gray/white tiles are still visible on the screen.
screen = pygame.display.set_mode((800, 600))
background = pygame.image.load('background.png').convert_alpha()
player = pygame.image.load('player.png').convert_alpha()
player_rect = player.get_rect()
player_rect.topleft = (100, 100)
How can I remove the background so that only the characters are shown?
I tried with convert_alpha()
command but it didn’t have any effect.
New contributor
GEORGE KASSOTAKIS is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
Check out our Code of Conduct.