I am fairly new to programming, so I bought the Book "Python Crash Course" by Eric Matthes. Recently, I decided to recreate the Pokemon Battle System in Pygame. So far, I have made a good enough framework to start the battle system. I picked the Pokemon Mew as a test subject. I already have the transparent backround for the picture, but pygame still shows the gray and white squares. This is my main code-file:
from settings import Settings
def run_game():
pygame.init()
ai_settings = Settings()
screen = pygame.display.set_mode(
(ai_settings.screen_width, ai_settings.screen_height))
pygame.display.set_caption("Pykemon Battle Simulator")
pokemon = Mew(screen)
mixer.music.load("battle_music.mp3")
mixer.music.play(-1)
while True:
screen.fill(ai_settings.bg_color)
pokemon.blitme()
for event in pygame.event.get():
if event.type == pygame.QUIT:
sys.exit()
pygame.display.flip()
run_game()
And this is my settings file for Mew:
import pygame
class Mew():
def __init__(self, screen):
"""Initialize the Pokémon Mew and it's location """
self.screen = screen
#Load the pokemon and get it's rect.
self.image = image = pygame.image.load("mew.jpg").convert_alpha()
self.rect = self.image.get_rect()
self.screen_rect = screen.get_rect()
#Start each new Pokemon at the bottom of the screen
self.rect.centerx = self.screen_rect.centerx
self.rect.bottom = self.screen_rect.bottom
def blitme(self):
"""Draw the pokemon's current location"""
self.screen.blit(self.image, self.rect)
And this(https://i.stack.imgur.com/MX6yC.jpg) is how it turned out. How can I make the of the Picture backround transparent?