I\'m working on some Python code that uses Pygame, trying to display a small sprite (a ball) on top of a background. I have that part working, but I\'m trying to get the bac
There's per-pixel alpha, colorkey alpha, and per-surface alpha. You're asking for colorkey.
When you call convert_alpha() it creates a new surface for per-pixel alpha.
And from set_colorkey
The colorkey will be ignored if the Surface is formatted to use per pixel alpha values.
So: Load image with .convert()
Since you want to use a color key. Then call set_colorkey
.
Also, I saw nothing in the docs about passing "-1" as first argument to set_colorkey.
That's probably from a tutorial, which has a load_image function to grab the topleft pixel's color value.