I have an image with a transparent background. When I blit the image on to the background of my game the transparent background appears on the screen (see image below)
here is my code:
import sys
import pygame
def runGame():
""" Function for running pygame """
pygame.init()
screen = pygame.display.set_mode((1200, 800))
pygame.display.set_caption("Car Simulator")
image = pygame.image.load('./car1.bmp').convert()
bg_color = (230,230,230)
# Start main loop for the game
while True:
for event in pygame.event.get():
if event.type == pygame.QUIT:
sys.exit()
screen.blit(image, (50,100))
pygame.display.flip()
runGame()
At first I thought it was because I was not using the convert()
method. However I'm still having the same issue. Any ideas on how I can get the background of the image to match the background of the screen. Any help would be appreciated. Thank you.