What I'm trying to do here is to start game either in window mode or in fullscreen.
def __init__(self, fsc):
pygame.init()
self.fullscreen = fsc
print(self.fullscreen)
if self.fullscreen:
self.screen = pygame.display.set_mode((0, 0), pygame.FULLSCREEN)
elif not self.fullscreen:
self.screen = pygame.display.set_mode((WIN_WIDTH, WIN_WIDTH))
self.clock = pygame.time.Clock()
#self.font = pygame.font.Font('Arial', 32)
self.running = True
If I try to print the self.fullscreen, it will print either True or False. However the conditions are ignoring it, and the game starts in the fullscreen mode anyway, even if the self.fullscreen is False.
CodePudding user response:
try to get rid of the elif and use just else
if self.fullscreen:
self.screen = pygame.display.set_mode((0, 0), pygame.FULLSCREEN)
else:
self.screen = pygame.display.set_mode((WIN_WIDTH, WIN_WIDTH))
CodePudding user response:
Turns out that in the other file, I accidentally made the variable a string:
# I had
player_info = [f'{nickname}', f'{gender}', f'{fullscreen}']
# Instead of
player_info = [f'{nickname}', f'{gender}', fullscreen]
Making the fsc = player_info[2] a string instead of boolen.
