I'm trying to make a very basic text based "game" if you want to call it that. I kept it pretty simple originally. But I wanted to make it unique to whichever "class" the player chose. So if they chose "Warrior" they would have events specific to that choice. I was trying to make it so you found gear specific to the type of player you chose. after it gets to "print("You awake in a tower and descend down the spiral staircase...")" it tries to go through my if statements. Then I get the error:
if advclass == (Warrior): NameError: name 'Warrior' is not defined
I can't figure out how to get this to work. Basically I want whatever the user input is for advclass to save and then I can do things like the if statements below. I just can't figure out how to define each class and do if statements and that type of stuff with it. Any help would be appreciated. I'm fairly new to python. I've just done one udemy class and have only done one other project by myself. Thanks in advance. My code is below.
advclass = input("Choose your Adventurer's class(Warrior, Mage, or Archer): ")
print()
print("Great... you have a long road ahead of you.")
print()
time.sleep(5)
print("You awake in a tower and descend down the spiral staircase...")
print()
time.sleep(3)
if advclass == (Warrior):
print("You find a chest outside of the tower. It contains armor, a sword, and a shield.")
elif advclass == (Mage):
print("You find a chest outside of the tower. It contains wizard robes, a wizard cap, and a magical staff.")
if advclass == (Archer):
print("You find a chest outside of the tower. It contains armor, 150 arrows, and a bow.")
print()
time.sleep(3)
Aucun commentaire:
Enregistrer un commentaire