dimanche 29 avril 2018

Changing variables as a result of it statements? (Python)

while True:
    for event in pygame.event.get():
        if event.type == pygame.QUIT:
            pygame.quit(); #sys.exit() if sys is imported
        if event.type == pygame.KEYDOWN:
            if event.key == pygame.K_d:
                if aa != "-\o/-":
                    print("Ok, stupid, WORK!!!!!!!")
                    aa = "     "
                    ab = "-\o/-"
                else:
                    print(m)
                print(m)
            if event.key == pygame.K_a:
                if ab == "-\o/-":
                    print("Ok, stupid, WORK!!!!!!!")
                    ab = "YAY!!"
                    aa = "-\o/-"
                else:
                    print(m)

This is a code snippet from a game I am creating. When this line is true: if ab == "-\o/-":, it should print "Ok, stupid, WORK!!!!!!!", and reassign the two variables. However, the variables do not get reassigned. I have searched this site and the internet for an answer to this problem, but I cannot find one. I have also tried defining something that would do it, but still no luck. Any thoughts?

Aucun commentaire:

Enregistrer un commentaire