Reputation: 83
]How do I get my sprite to appear on the screen. i have been days at this and I couldn't get it to appear on the screen and it kept either taking over the screen as black.
import pygame pygame.init() win = pygame.display.set_mode((600,600))
pygame.display.set_caption("Napoleon")
bg = pygame.image.load("apple.png").convert() win.blit(bg, [0,0])
flower= pygame.image.load("flower2.png").convert() win.blit(flower, [603,29])
pygame.display.update()
Upvotes: 3
Views: 1527
Reputation: 2298
Instead of convert()
try convert_alpha()
. Assuming your image has an alpha channel (PNG should be good) and it has been applied to your background. If your image has no alpha channel and you need a background gone, you should look into the set_colorkey()
function.
Also, for future reference, you can format your code in your question by highlighting it all and pressing CTRL+K
. Makes it much easier to read (and you'll get faster answers!)
Upvotes: 5