global maxHP global HP global maxMP global MP global gold global loop1 gold = 0 def start(): print "An evil dragon known as Draco has taken control of the world.\nHe has a big army of minions who do his bidding and his dirty work.\nYou must rise and defeat him and all his minions." choice = raw_input("one is the choice") if choice == 1: dragoncave() else: dragoncave() def dragoncave(): while gold != 100: print "YOU NEED 100 GOLD TOO LEAVE!" print "You found 100 gold!" gold = 100 loop1 = 1 print "YOU WON!" loop1 = 0 while loop1 == 0: start()
It says there is an error when going to the dragoncave, and that gold was used before it was defined. What is wrong? I have tried to define gold again, but it didn't work.