""" Welcome to Rondi, my Textbased RPG. This is my second game, but my first game that actually works like a game. Please leave suggestions at =-=-=-=-=-= and I'll look at them and see what it is. Once this actually works fully, I will be Improving on it from time to time, so, enjoy. Current To Do List: - Figure out what the heck a End of Line error is - Get Random Encounters Working - Functions to shorten coding neccecary -Once program works, debug and grammar check. Then try for extra credit in every class possible due to this program. """ import random #Should make the name variable. Hitting and End of Line condition? Wut's that? name = raw_input("Ah, a new arrival. Tell me, lost one, what was your name?") print "\nPlease tell me a little about yourself, " + name + "." #Variables for backstory. Might add some RNG to it, but that wasn't working to well earlier. Growing_Up = raw_input("Where did you grow up?") Parentage = raw_input("\nWho was your father?") gender = raw_input(" \nAre you a boy or girl?") def genderFinder(): if gender == "girl" or gender == "Girl" or gender == "female": gender_words = ["she" , " her " , "herself" ] elif gender == "boy" or gender == "Boy" or gender == "brilliant idiot" or gender == "male" : gender_words = ["he" , " him " , "hiself" ] else: raw_input("What is your gender?") genderFinder() #Hero varibles. potionList = [ "Heal" , "Flee" ] money = 0 spellList = [ "Freeze" , "Fire" , "Lightning" ] heroAttack = 10 heroSpeed = 10 heroDefence = 10 heroHealth = 150 encounterNumber = random.randint(1,100) #Test encounter if encounterNumber >= 100: print "A lumbering giant appears!" enemyHealth = 75 enemyAttack = 10 enemySpeed = 2 enemyDefence = 5 while enemyHealth > 0: action = raw_input("What do you do? [attack, spell, potion, flee]") if action == "attack": enemyHealth -= heroAttack* 1.5 - enemyDefence damageDone = 75 - enemyHealth print "You did " + damageDone + " damage, enemy has " + enemyHealth + " health left." elif action == "spell": spellUsed = raw_input("What spell do you use? [" + spellList + "]" ) print "This feature will be added at a later date. Please try again later." elif action =="flee": if heroSpeed > enemySpeed * 1.5: print "You ran away!" else: print "Flee Unsuccesfull!" elif action == "potion": potionUsed = raw_input(potionList) if potionUsed == "Heal" or potionUsed == "heal": if heroHealth < 129: heroHealth = 150 else: herohealth = 175 elif potionUsed == "flee" or potionUsed == "Flee": print "Flee successfull!" sys.exit()
Run
Reset
Share
Import
Link
Embed
Language▼
English
中文
Python Fiddle
Python Cloud IDE
Follow @python_fiddle
Browser Version Not Supported
Due to Python Fiddle's reliance on advanced JavaScript techniques, older browsers might have problems running it correctly. Please download the latest version of your favourite browser.
Chrome 10+
Firefox 4+
Safari 5+
IE 10+
Let me try anyway!
url:
Go
Python Snippet
Stackoverflow Question