开发者

Pygame - calling surface.convert() on animated sprite causes transparent background to become white

开发者 https://www.devze.com 2023-01-14 15:24 出处:网络
Everyone says to use .convert() on surfaces to speed up animations (which will be an issue with my game because it will be an MMO to some extent, so it might have a dozen or a couple dozen characters

Everyone says to use .convert() on surfaces to speed up animations (which will be an issue with my game because it will be an MMO to some extent, so it might have a dozen or a couple dozen characters moving at the same time), the problem is that my transparent PNG images work great without convert but as soon as I use .convert() all of the transparent backgrounds suddenly become开发者_如何学编程 white

Do I need to sample the color and make it transparent using color_key?


convert_alpha should do the trick

http://www.pygame.org/docs/ref/surface.html#Surface.convert_alpha

0

精彩评论

暂无评论...
验证码 换一张
取 消

关注公众号