I am trying to make a selection screen but only the first function in order works does anyone know how to fix this?
while mainloop:
if characterpick:
if selection_elf():
print("elf")
characterpick = False
elif selection_berserker():
print("elf")
characterpick = False
elif selection_mage():
print("melf")
characterpick = False
if start():
characterpick = True
background_image = pygame.image.load("character selection screen.png")
background_image = pygame.transform.scale(background_image, (750, 750))
functions:
selection_elf function:
def selection_elf():
for event in pygame.event.get():
if event.type == pygame.MOUSEBUTTONUP:
mouse_pos = pygame.mouse.get_pos()
if mouse_pos[0] >= 255 and mouse_pos[1] >= 195 and mouse_pos[0] <= 503 and mouse_pos[1] <= 500:
return True
selection_mage function:
def selection_mage():
for event in pygame.event.get():
if event.type == pygame.MOUSEBUTTONUP:
mouse_pos = pygame.mouse.get_pos()
if mouse_pos[0] >= 510 and mouse_pos[1] >= 195 and mouse_pos[0] <= 758 and mouse_pos[1] <= 500:
return True
selection_berserker function:
def selection_berserker():
for event in pygame.event.get():
if event.type == pygame.MOUSEBUTTONUP:
mouse_pos = pygame.mouse.get_pos()
if mouse_pos[0] >= 0 and mouse_pos[1] >= 195 and mouse_pos[0] <= 248 and mouse_pos[1] <= 500:
return True