1

I am blitting a spaceship image, but it has a black background against my blue surface. I have used colorkey to attempt to make the background of the spaceship transparent. However, it still doesn't work, and now there's just a black blob behind my spaceship. Can anyone fix this?

screen.blit(background, background_rect)
image = pygame.transform.scale(player_img, (50, 38))
image.set_colorkey(BLACK)
screen.blit(player_img, (10, HEIGHT - 120))
screen.blit(player_img, (WIDTH - 110, HEIGHT - 120))
Blazian444
  • 131
  • 9
  • `image.convert_alpha()` ? – furas Aug 03 '19 at 21:53
  • 1
    it is allways better to create images eith correct size in any image editor - Photoshop, Gimp, Painter, etc. – furas Aug 03 '19 at 21:54
  • probably you define `BLACK` as `(0,0,0)` but image may have pixesl in color similar to black like `(1,1,1)` or `(2,2,2)` and many, many others - and then `set_colorkey(BLACK)` will not work. You may get color of first pixel and use it in `set_colorkey()`. OR create png with correct size and transparent background (channel alpha) and then use `convert_alpha()` instead of `set_colorkey()` – furas Aug 03 '19 at 21:57

0 Answers0