The function start_menu() leads to run_instructions() after a button press. In run_instructions() once a user clicks the mouse again it should go to another function however I think the click from the previous function carries on and automatically triggers click[0] to = 1 despite the fact no one has clicked anything.
def run_instructions():
clicked = False
while clicked == False:
click = pygame.mouse.get_pressed()
board.blit(instructions,[0,0])
pygame.display.update()
for event in pygame.event.get():
if event.type == pygame.QUIT:
pygame.quit()
quit()
if click[0] == 1:
create_environment()
clicked = True
def start_menu():
global menu
while menu == True:
for event in pygame.event.get():
if event.type == pygame.QUIT:
pygame.quit()
quit()
mouse = pygame.mouse.get_pos()
click = pygame.mouse.get_pressed()
if 125 + 172 > mouse[0] > 150 and 448 + 69 > mouse[1] > 448 and click[0] == 1:
menu = False
run_instructions()
break
Is there anyway to make click[0] update or reset it to 0 when it enters run_instructions(). I've tried using pygame.MOUSEBUTTONDOWN but it gives the same problem.
Thanks.