0

正如标题中所说,我无法在我拥有的精灵上使一种颜色透明。我将颜色键设置为白色,但精灵上的空白区域不会变得透明。

这是我所拥有的:

player_image = pygame.image.load("blanksprite.png").convert()
player_image.set_colorkey(white)
screen.blit(player_image, [x,y])
4

2 回答 2

0

我对 Pygame 还很陌生,但是如果你使用Surface.convert_alpha而不是 ,它会起作用Surface.convert吗?

player_image = pygame.image.load("blanksprite.png").convert_alpha()
于 2013-08-11T12:53:04.620 回答
0

I placed 'player_image.set_colorkey(white)' in the wrong place, after the image was blitted at first, and before the main program. I moved it to right before the image was to be blitted and it became transparent.

于 2013-08-11T13:00:44.467 回答