Hi. I've never used these forums, but I couldn't find an answer to my question in other places. I've been using the codecademy python track, and have been making my own little game. I made a function, prologue, and that works fine. I made another one, ActionChoice, that worked, but once I added a few things to the function, it says it's not defined. Please help, I can't figure out what the problem is.
- Code: Select all
#New Game, with variables, and better choices.
Money = 500
Wall_Health = 250
Wall_Rate = 25
Tax = 50
print "Welcome to A Tale of Kings, a sequel to A Tale of Things. This game is not like AToT, because you are not just choosing little tiny paths. Your choices carry on, and you deal with money, foreign relations, and other troubles."
Name = raw_input("What did you say your name was?")
print "Ah right. You are the good Sir " + Name + ", One of the members of a great council for a king. This king, who rules the small kingdom of Tarnor, is currently facing a dilemma. It appears that a larger kingdom by the name of Engon has taken a fancy to your Amethyst deposits. They have attacked!"
poop = raw_input("How much money do you think you have?")
print "You have a small amount of money to work with, 500 Amethyst Royals. 'Tis a pity that the Amethyst Royals are so easy to come by, they are worth practically nothing. You will have to be clever with your useage of these funds."
print "You also have a good sturdy wall made out of cardstock. It currently has 250 layers of cardstock, and you hope it will last. Unfortunately, every action that you do, the enemy attacks your wall for 25 damage. Work fast!"
print "You think that you might be able to survive this war if only you could get the assistance of one neighboring kingdom, Farlon. The problem is, the king of that nation has set a price, 25 Golden Dragons for his help (Equivalent to 1500 Amethyst Royals). You will have to see if you can raise the funds....)"
Action = raw_input("What would you like to do? Make sure to type in all caps. BUILD WALL, COLLECT TAXES, SHOP?")
if Action == 'BUILD WALL':
if Wall_Rate == 25:
print "You build up the wall 25 layers, but the enemy also attacks it for 25 damage. You might want to buy some building tools in the shop."
Wall_Health = Wall_Health - 25 + Wall_Rate
print "You build your wall up some, just as your enemy attacks it. You heal the wall " + Wall_Rate + ". The Wall health is now " + Wall_Health
elif Action == "COLLECT TAXES":
Wall_Health = Wall_Health - 25
Money = Money + Tax
if Tax == 50:
print "You go out and collect 50 Amethyst Royals from your subjects. Your money is now " + Money + "Pretty good, but remember you can buy Tax collectors in the shop that will raise your tax rate. Also, the enemy attacked, so your wall's health is now " + Wall_Health
print "You collect taxes from your subjects. Your money is now " + Money + ". The enemy attacked, so your health is now " + Wall_Health
elif Action == "SHOP":
Wall_Health = Wall_Health - 25
print "Welcome to the shop!"
print "We have many choices for you. Which menu would you like to see? Building tools? Tax Collectors? Or Weapons?"