I am trying to put in a background image for my game and I need that at certain opacity. I have used the method set_alpha()
of surface to control its translucency. However, this is creating a fade-in effect with the initial background at the set opacity turning to its full brightness eventually. Is there any way I can set the translucency of the background to a constant value?
My code is
self.bg = pygame.image.load("../game_images/background.png")
self.bg_size = self.bg.get_size()
self.bg_rect = self.bg.get_rect()
self.bg.set_alpha(5)
self.screen = pygame.display.set_mode(self.bg_size,pygame.FULLSCREEN)
self.screen.blit(self.bg, self.bg_rect)
pygame.display.update()
Any hints on how to do this?