📜  pygame 中的破坏图像 - Python 代码示例

📅  最后修改于: 2022-03-11 14:47:14.238000             🧑  作者: Mango

代码示例2
You can fill individual images, since they are pygame Surfaces.

First, what I would do is I would put something like this after defining the leaf's x/y:

leaf.image = img1

Then, I would create a color variable called transparent:

transparent = (0, 0, 0, 0)

The first 3 numbers, as you might know, represent RGB color values. The last number is the alpha (transparency) value of a color. 0 is completely invisible.

Finally, I would add this code to make the leaf completely transparent:

leaf.image.fill(transparent)

This makes the leaf transparent without making every other image in your window disappear. Hope this helped!