Background image is constantly loaded in Python

1

Good morning, I have a game in python to which I assign a background that I want to be changed by another when I reach a number of points, the problem is that when the background is changed it is constantly loaded and the framerate is lowered, it is because Does the IF constantly execute the call to the image or that I'm not seeing?

# Clase para la escena del juego   class Game():
def __init__(self):

    # Cargamos el fondo.
    self.fondo = load_image('Fondo1.png', IMG_DIR)
    self.primera_vez = True 
# Segundo nivel

    if  self.puntos > 1:
        self.fondo = load_image('Fondo2.png', IMG_DIR)
        self.primera_vez = True

You are missing a lot of things that you do not add because they are irrelevant.

    
asked by MrBean 21.12.2018 в 19:55
source

0 answers